Wondering cost in completing this assignment
Microsoft Word - Assignment 1.docx : Assignment 1.docx Author: Haytham Fayek Save Date: 10/07/2020 Page 1 of 7 School of Science Assignment 1 COSC1284 Programming Techniques July 2020 Assessment Type: Individual assignment. Submit online via Canvas → Assignments → Programming Assignment #1. Marks awarded for meeting requirements as closely as possible. Clarifications/updates may be made via announcements/relevant discussion forums. Due date: Week 5, Friday 21st August 2020, 11:59pm. Late Submissions/Extensions: A penalty of 10% per day is applied to late submissions up to 5 days, after which you will lose ALL the assignment marks. Extensions will be given only in exceptional cases; please refer to the special consideration process. Weighting: 25% 1 Overview A programmer can take fundamental programming concepts and, with the experience they have gained from analysis, evaluation and problem solving, put them together to solve new problems. For this assignment, you will take on the role of a freelance programmer who has been given a small program to write. The program will present a menu to the user with two functions: • Unit Converter • Lotto Checker The requirements for the menu and the two functions are reported in detail below. Menu The menu presents the user with a choice of running either the Unit Converter or the Lotto Checker. The user inputs required by the user are presented as part of the menu display. The implementation of this method must abide by these constraints: School of Science Assignment 1 Author: Haytham Fayek Save Date: 01/07/2020 Page 2 of 7 M1. The menu will run as a once-off, and it should not be re-displayed again as the program will terminate after any function has been completed. M2. An incorrect input will cause the program to prompt the user for another input. M3. After three unsuccessful attempts, an incorrect input will cause the program to display an error message to the user (e.g., “The input was incorrect!”) and then terminate. M4. A correct input will cause the program: a. To execute the chosen function; b. To require the user input of their three parameters from the console; c. To display the output of the chosen function; d. To finally terminate. Unit Converter This method will be declared as such: private double convert(double number1, int operation) The method performs one of six predetermined unit conversion operations: convert Celsius to Fahrenheit, convert Kelvin to Fahrenheit, convert Celsius to Kelvin, convert Fahrenheit to Kelvin, convert Fahrenheit to Celsius, and convert Kelvin to Celsius. Each of these operations are represented by an integer: Celsius to Fahrenheit (0), Kelvin to Fahrenheit (1), Celsius to Kelvin (2), Fahrenheit to Kelvin (3), Fahrenheit to Celsius (4), and Kelvin to Celsius (5). The implementation of this method must abide by these constraints: U1. Two parameters must be taken as input U2. The first parameter should be the unit to be converted. U3. The second parameter takes values in the range 0--5, and it indicates the type of conversion to be performed. U4. The method returns only the result of the conversion. U5. The method returns -1.0, if the operation supplied is invalid. Lotto Checker This method will be declared as such: private String checkLotto(int chosen1, int chosen2, int chosen3) The implementation of this method must abide by these constraints: L1. Lotto numbers are drawn in the range between 1 and 48. L2. A number may be drawn one or more times in any single draw. L3. This method should receive 3 number picks from a user that represent the numbers chosen by a player. L4. The numbers chosen by the player must fall within the range of the field of numbers being drawn. L5. Each time the method is called it will generate eight random numbers within the predefined range (1--48). L6. The method should return a string that informs the user of the results of the draw including the drawn numbers, the numbers chosen by the player, which numbers were correct guesses by the player and how many correct guesses occurred in the draw. L7. The method should also notify of any error e.g., if the number picked by the user fall outside the prescribed range. This program will demonstrate the following key skills: 1. Creating a small program to demonstrate what you have learned as a developer. 2. Analysing a problem and developing an algorithm to solve the problem. 3. Converting an algorithm to computer code. 4. Writing code using best practices (within the limitations placed on you by this specification) 5. Documenting your program. School of Science Assignment 1 Author: Haytham Fayek Save Date: 01/07/2020 Page 3 of 7 Read the requirements thoroughly! There are specific constraints that have been placed on you for this assignment to force you to work within defined parameters. The ability to work within a pre-defined set of parameters is a fundamental skill required by any software developer. You will also need to debug code on your own. You are given marks on your ability to fulfil all requirements of this document. Develop this assignment in an iterative fashion, as opposed to completing it in one sitting. You should get started now as there are concepts even from the week 1 lessons that you can incorporate into your program. Any questions regarding this assignment must be asked via the relevant Canvas discussion forums only (no emails to teaching staff, please) in a general manner. 2 Learning Outcomes This assessment relates to the following course learning outcomes: • CLO1. Demonstrate (through small programming exercises) knowledge and skills with concepts of program design and acceptable coding standards. • CLO2. Use Java programming language as a vehicle to demonstrate good software development practices. • CLO3. Use arrays and control structures to demonstrate skills of basic algorithms and data structures. • CLO5. Analyse requirements for a small-scale programming project. • CLO6. Design and implement small-scale software systems. • CLO8. Demonstrate skills for self-directed learning. 3 Assessment Details Your code must meet the following code requirements (section 3.1) and documentation requirements (section 3.2). 3.1 Coding Requirements (15 marks) The following code requirements must be applied similarly to what has been shown in lesson materials. Also, refer to corresponding rows in the rubric (see Section 6). C1. Code presentation and format: The program must be written in exactly two files. One file should contain your ‘main method’ and should only be responsible for starting the program. The name of the class (file) with the ‘main’ method must be called ‘Driver.java’. The second file should contain the program logic. The name of the second class (file) must be called A1.java. Code is formatted consistently and follows the standard Java coding conventions. You must not include any unused/irrelevant code (even inside comments); the code you submit must be considered the final product. The code should be submitted as a Visual Studio Code Java project. School of Science Assignment 1 Author: Haytham Fayek Save Date: 01/07/2020 Page 4 of 7 C2. Data types, user inputs and program outputs: You must use the Scanner class for any user input related functions. Variables and constants should reflect the most appropriate data type for the data they are representing. Variables and constants should not be defined at the class level i.e. only defined locally with a method. Constants should be used for any fixed values even if only used once in the program to increase readability of your code. You should avoid the use of ‘hard coded’ (magic numbers) values when used they must be defined as a constant. Formatting of output to the console must be done using the printf method and not via escaped tab sequences or manual spacing. You are not permitted to use ArrayLists or any other data structures. All your variables and constants must be a primitive type or a String data type. C3. Conditional Logic: You should use if/else if/else (or switch/case) appropriately and exclusively for non-repeating conditional execution. Contains at least one reachable else if statement. Every code block in every if/else - if/else (or switch/case) structure must be reachable. You must not have any redundant conditions. C4. Repetition You are not permitted to use any type of loop in this program. Any code repetition should be reduced by writing cohesive methods. C5. Algorithm development and method implementations You must not use static anywhere in the program except in the main method. Methods should be cohesive and used to represent each step in an algorithm in order to keep each method as small as possible. There is at least one method in addition to the ‘main’ method. Methods are used to reduce code repetition. Every created method is used in the program. Methods are appropriately private or public. Control/execution within each method always reaches the very last statement of that method (no spaghetti code e.g., please, avoid return statements in the middle of the method). Methods may contain parameters and/or return values. In places where this specification may not tell you how exactly you should implement a certain feature, the programmer (you) need to use your judgment to choose and apply the most appropriate concepts from class materials. Follow answers given by your instructors under