0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)
166 Ansichten6 Seiten
This document provides the specification for an assignment to develop a simple menu-driven program in Java. It includes several parts: code comprehension questions about a sample program, requirements for the program to be developed, a design section, an implementation section, and testing requirements. Students are asked to develop a program with a menu that allows users to input data into a 2D array, view reports from the data, and quit. The program must include various Java constructs like loops and conditionals.
This document provides the specification for an assignment to develop a simple menu-driven program in Java. It includes several parts: code comprehension questions about a sample program, requirements for the program to be developed, a design section, an implementation section, and testing requirements. Students are asked to develop a program with a menu that allows users to input data into a 2D array, view reports from the data, and quit. The program must include various Java constructs like loops and conditionals.
This document provides the specification for an assignment to develop a simple menu-driven program in Java. It includes several parts: code comprehension questions about a sample program, requirements for the program to be developed, a design section, an implementation section, and testing requirements. Students are asked to develop a program with a menu that allows users to input data into a 2D array, view reports from the data, and quit. The program must include various Java constructs like loops and conditionals.
Assignment 1 Development of Simple Menu Driven Program Due Date: Week 7 (see Course Description for further details) Please see the Course Description for further information related to submission date, extensions for assignments and Special Consideration. You may be required to demonstrate your working code to your tutor in your lab class. Project Specification For this assignment you are required to specify, design, implement and test a menu driven program of your own design. For example you could design a program that supports scoring of a sporting event, keeping records of student grades within a class or any system you can imagine involving storing numbers in a two dimensional array. You are provided incomplete sample starter code that you can modify and build upon. You are expected to fully comment the provided code as well as your own code. Resources Provided The following files/links are available on Moodle: An electronic copy of this assignment specification sheet The General Guide for the Presentation of Academic Work A sample incomplete program to get you started
Note: If you use any resources apart from the course material to complete your assignment you MUST provide an in-text citation within your documentation and/or code, as well as providing a list of references in APA formatting. This includes the use of any websites, online forums, books or text books. If you are unsure of how to do this please ask for help. Design Constraints Your program should conform to the following constraints: it should include at least one example of the successful and appropriate use of : o a two-dimensional array containing numbers o a switch statement o an if statement o a while-loop o a do-while loop o a for-loop you must successfully code the showReport() method and one other new method. it must be able to handle invalid data which lies outside of a specified range e.g. number of competitors <0 or a result of -5. You can assume that the correct data type has been entered i.e. if you are expecting the user to enter data of type int then integers will be entered. you must use appropriate formatting and programming styles (i.e. naming, formatting and commenting of code).
CRICOS Provider No. 00103D ITECH 1000/5000 Programming 1 Assignment 1 Specification Page 2 of 6 You are encouraged to add additional functionality to your program but as a minimum you must complete the requested tasks. When finished, check the marking guide to ensure you have addressed all of the above constraints.
NOTE: Code that does not successfully compile will not be marked. In such cases, only the specification, design and question sections of the assignment will be awarded marks. If you are unable to get your code to compile, please state this clearly in your submission and comment out the offending code prior to handing in your work. Even if your code compiles but has warnings, marks will be deducted. (See your tutor for help prior to submission) Part A Code Comprehension Sample code has been provided in Moodle. Use the sample code provided to answer the following questions: 1. When the program is first run and menu item 2 is selected what is displayed? Why is the output displayed as it currently is? 2. Explain how the loop displaying the menu and processing a response is exited. What value does userOptionSelected have when the program finishes? Describe what happens on this line: userOptionSelected = m.getsel(scan); // get a user option entered . 3. The reserved word break is used in the switch-statement to manage the menu selection. What happens if you remove the break statement in case 1? 4. Currently, if the user enters an incorrect menu selection (such as 5) what happens? Explain why the error message is displayed. What method and line of code is responsible and why. 5. What alternative looping structure could have been used for the main while loop? 6. Explain the purpose of the boolean variable finished. 7. Briefly explain the two lines of code that have been used to create the array to store the scores for each competitor. In your explanation, provide a diagram to illustrate how the array is stored. 8. Explain what would happen (and why) if the code in the while loop was changed to: while(finished=true);
9. Currently, menu item one prompts the user for data for up to 3 rows of data and 4 values in each row. What change would you have to make to the code so that the data contains 6 rows of data, with 4 values on each row? 10. The design of the output for menu selection 2 needs to be changed so that it displays the data as per the following: Row 1: 1 1 1 1 ===================================== Row 2: 2 2 2 2 ===================================== Row 3: 3 3 3 3 =====================================
Provide the changes to the code that you need to make to do this. 11. Explain how the nested for-loop in the enterdata method could be altered so that the user could specify how many rows and how many columns of data to enter for each particular run (up to the maximum values possible)? For example, the maximum number of cols is 4 but the user of the program indicates that only 3 columns will be entered.
CRICOS Provider No. 00103D ITECH 1000/5000 Programming 1 Assignment 1 Specification Page 3 of 6 Part B Program Requirements The first part of the assignment is to describe the requirements of your program to be developed. This should provide enough details so that another programmer would be able to design and implement the program. Your program should present the user with a menu that provides at least the following functionality: Input the number of competitors, judges, students, players, attempts, etc Input numbers to fill your two-dimensional array View reports at least two different reports (e.g. total score per competitor, average score per judge) Quit the system Your requirements should allow your program to conform to the design constraints listed above. A basic sample of program requirements has been provided for you to refer to (see page 6 of this document for the Sample Specification). You are required to check with your either your lecturer or tutor before continuing to ensure the problem you are considering is appropriate. Part C Anal ysis and Design Design a program for the task you have specified in Part B. You should include: 1. A description of the methods used to address the program requirements 2. High level pseudo-code for each menu option and associated method 3. Test data Once you have completed your pseudo-code, perform a desk check of your logic. If you find any problems with your pseudo-code you should redesign and retest. Details of any refinements that you have made to your algorithm and further testing that was conducted should be included in your design. Ensure you plan requirements so that the showreport method and your new method will do something interesting with your data. Part D Implementation and Development Using design developed in Part C, implement the program in J ava. You could be using the sample java code provided as a starting point and your first task would be to appropriately comment the code provided. Once you have finished this task, then you can update the code so that it conforms to your own specifications. Your code should use appropriate programming standards and should be well documented/commented. You are permitted to discuss the sample program with your peers in order to understand it. However, you must ensure that you complete this section individually. It is expected that no two students will have the same program. You need to be creative in order to ensure your program is unique. Part E Testing Using the data developed in Part C, test your program to ensure that it works as specified and that there are no logic errors in your code.
CRICOS Provider No. 00103D ITECH 1000/5000 Programming 1 Assignment 1 Specification Page 4 of 6 You will need to provide evidence that the testing has been completed it is suggested that you make use of tables to display the data and testing. Assignment Submission Your assignment should be completed according to the General Guidelines for Presentation of Academic Work. The following criteria will be used when marking your assignment: successful completion of the required tasks complexity of code in your showReport() method and your new method (e.g. if you have a simple report involving a one line calculation, you will not get as many marks as if your report is more complex in logic) quality of code that adheres to the programming standards for the course including: comments and documentation code layout meaningful variable names (it is expected that you will change the names of variables in the sample code provided and alter the size of the array to suit your circumstances) check that data entered is valid
You are required to provide documentation, contained in an appropriate file, which includes: a front page - indicating your name, a statement of what has been completed and acknowledgement of the names of all people (including other students and people outside of the university) who have assisted you and details on what parts of the assignment that they have assisted you with a table of contents and page numbers answers to the questions from Part A the program requirements(specification) design details - including requirements, algorithm, test data details of test data and evidence that the testing was conducted list of references used (APA style); please specify if none have been used. An appendix containing your code
Using the link provided in Moodle, please upload the following in one zip file: 1. your code (SurnameStudentIdAssign1.java) 2. your report (surnameStudentIDAssign1.docx)
You may be required to demonstrate your working code to your tutor in your lab class.
CRICOS Provider No. 00103D ITECH 1000/5000 Programming 1 Assignment 1 Specification Page 5 of 6 Marking Guide PART A Code Comprehension /11 PART B Specification of the problem /9 PART C Anal ysis and Design /10 PART D Implementation and Development Sample code suitably modified and extended to fit requirements (/10) ShowReport method (/10) Additional Report method (/10) Validation (/5) /35 PART E Testing Evidence in report as well as in code /10 Additional Functionality (eg. an Extra menu item for a 3 rd report) /5
Total /20 /80
CRICOS Provider No. 00103D ITECH 1000/5000 Programming 1 Assignment 1 Specification Page 6 of 6 Sample Specification The following is provided as a sample specification of requirements. The specification that you provide should provide at least as much detail as provided here although your description will be different as will your menu options. This program will assist with the scoring of a surfing competition. The organizers at this point are unsure of the exact number of judges or competitors, but they do know that there will be between 2 and 8 judges, and between 3 and 6 competitors. Each competitor is to be given a colour, red, blue, yellow, green, white, or black to compete under. (ie competitor # 1 is red, competitor # 2 is blue, etc. ) The judges enter a score for each competitor, the highest being the number of competitors, the lowest being 1. eg if there are 4 competitors, the winning score is 4, second is 3, third is 2 and fourth (last) is 1. Scores must be between 0 and 10 inclusive.
If there were 4 competitors, a judges scorecard could look like the following:
Judge # 1 Competitor Red Blue Yellow Green Score 7 6 10 8
This ranks the Yellow competitor 1 st , Green 2 nd , Red 3 rd and Blue 4 th or last.
At the end of the day, the organizers would like to be able to summarise the scores as follows: Total scores for each competitor. Average score for each competitor. Average score for each judge. Maximum score awarded
They would also like to be able to print out the raw data of the final scores. The program will provide a menu of functions that the user can select from. Option 1 will ask the user to enter the data for the competition. Option 2 will display all the raw data. Option 3 will show the total scores for each competitor. Option 4 will calculate and show the average score for each competitor. Option 5 will display the average score awarded by each judge. Option 5 will show the highest score and which competitor was awarded this score. The program will verify all data entered to ensure that only correct data types within the expected ranges are entered. The program provides users with the opportunity to choose how they wish to look at the data and gives them the option of looking at it more than once.