For this assignment you will be provided with incomplete sample starter code that you can modify and build upon. Your task will be to carry out the design, analysis, coding and testing to add several additional features to this sample code. You are expected to fully comment the provided code as well as your own code. The sample code provided has some minor issues that mean that although the code compiles it does not run as required.
The program that is to be developed should enable the entry of data from a short survey and to provide the user with some short reports on this data.
The data to be entered is from a survey and initially includes the following information:
The program should present the user with a menu that provides the following functionality:
Further details on functionality are provided in the task specifications provided below
Your task is to first answer some questions testing your comprehension of the partial solution. Use the sample code provided in StarterCode.java to answer the following questions. Include the answers in your assignment submission.
1. The code provided does not contain any comments.
2. Identify all of the lines of code within the program that are associated with obtaining user input. This can be done by either copying the lines into your answers or highlighting the lines within the code.
3. The variable finished should be used as the condition for the while loop.
4. Run the program. When the menu is presented enter 2 as the selected item.
case 1: System.out.println("Menu selection 1");
for(int i=0;iSystem.out.println("Enter Response 1");
5. Identify the lines that would need to be altered so that the menu is controlled by a do-while loop rather than the whileloop and provide the new lines of code required
6. Currently a switch-statement is used within the program to handle the different menu options. What other program structure could have been used?
7. Run the program.
Menu Selection Expected Actual Notes
1 Displays "Menu selection 1" and prompts the user for the responses for gender Displays "Menu selection 1" As expected
2 Displays "Menu selection 2" and contents of the array for each student
3 Displays "Menu selection 3"
4 Displays "Menu selection 4"
5 Exits the program -1 Error -6 Error
8. With the program an array has been used to store the data. Currently the code has two lines declaring the array, one that has been commented out.
It is suggested that you design, implement and test each of detailed below in order completing each section completely and correctly before proceeding to the next. For each stage, with the exception of stage 1, you should:
1. design a solution in the form of pseudo-code to carry out the required task - include this pseudo-code as part of your project documentation, clearly indicating which stage it belongs to;
2. perform a desk check of your logic - if you find any problems with your pseudo-code you should redesign and retest;
3. implement the stage update the code so that it implements the algorithm you have designed - at the end of each stage listed below save a copy of the code that has been developed and name each file appropriately;
4. test the stage ensure that before moving onto the next stage of development that the program works and that there are no logic or runtime errors
1. Update the code so that it:
2. Update menu item 1 case so that:
Gender (1=Male 2=Female 3=Other 4=Unspecified) :
Left or right handed (1=Left 2=Right 3=Both):
Super power (1=Invisibility 2=Super strength 3=…):
Life preference (1=Famous 2=Happy 3=….):
Age (in years):
3. Update menu item 2 so that it displays all of the raw data that is stored in the array. For example:
Num Gender Lefty? Power Life Age
0 0 0 0 1 29
1 1 1 1 0 20 Etc..
4. Update menu item 3 -.display at least one graph using the data that has been entered. For example you might display a histogram of the genders or super powers. Within your documentation you should design and briefly explain why you have decided to design that particular graph.
5. Update menu item 4 so that it displays a short report on the results. In your documentation you should provide a design the report and a brief explanation of why your report has been designed that way. Your report must include at least the following:
6. Data validation add code to validate any data entered by the user. For example: for menu item 1 the data for gender should be validated so that only the values between 1 and 4) will be stored by the program; if an invalid test score is entered the user should be re-prompted to enter a new value until a valid score is entered.
7. Final Challenge: Complete this only after you have completed all of the tasks have sufficient time. Copy of the code into a new file and break the program down so that it utilises methods to handle each of the menu items.
You should be testing your program as each stage is completed, and again once the program is complete. You should document the testing data, process and results (e.g. in the form of a table) and include this within your project documentation. Your mark for this section will reflect the thoroughness of your testing and the quality of your documentation.