Development of Simple Menu Driven Program
Question
Answer:
Program Requirements
- Number of Cols
- Number of Rows
- Member data such as Name, Age, Level and Fee
Algorithm
Step 1: Program Starts
Step 2: variable declaration
Step 3: Infinite while loop starts
Step 4: Read the user choice
Step 5: Check if the user choice is 5, go to Step 11
Step 6: Check if the user choice is 1, system read the data of rows, cols and member data and stored into two dimensional array, then go to Step 10
Step 7: Check if the user choice is 2, system display the two dimensional array values, then go to Step 10
Step 8: Check if the user choice is 3, system calculates sum and average age of all member details and print the average age and then go to Step 10
Step 9: Check if the user choice is 4, system calculates sum of member fee and display it. Go to Step 10
Step 10: Go to Step 3
Step 11: Program Ends
(1) If we select the menu item 3, the following result will be displayed,
Number of row limit is 3, so the system validate input and display the error message and then read the another value for row (ie, number of members)
(4) The loop displaying the menu and processing a response is exited are as follows
What value does userOptionSelected have when the program finishes?
If userOptionSelected is 5, the program finished
Describe what happens on this line:
userOptionSelected = m.getsel(scan); // get a user option entered.
getsel is a function, it has one parameter which is a scanner object. It is used to read the user option. And the function returns the user choice value and stored into userOptionSelected variablesIf we remove the break statement in case 3,
Assumption1:
userOptionSelected is 3, the control move to case 3, then execute the case 3 method then control move to case 4 and process the case 4 method also. So that we must use break in all case
If user enter the selection is 6, system displays the error message. Because default case of switch statement will be executed.
(7) We may use do..while loop statement instead of while loop
(8) The purpose of the boolean variable finished is.
In while statement, it checks the Boolean value or relational expression. So that we used Boolean value for handling while loop. If finished is true, control exit from the loop, otherwise, control process the loop
(9) The Explaination of two lines of code that have been used to create the array to store the scores for each competitor with a diagram to illustrate how the array is stored.
Integer[][] score;
Score=new Integer [5][6];
Row is 5, columns is 6.
Five competitor and 6 scores for each competitor
0 |
1 |
2 |
3 |
4 |
5 | |
Competitor0 |
10 |
5 |
12 |
20 |
12 |
15 |
Competitor1 | ||||||
Competitor2 | ||||||
Competitor3 | ||||||
Competitor4 | ||||||
Competitor5 |
(10) Iif the code in the while loop was changed to then:
while(finished==true)
Loop will be infinite
(11) Currently, menu item one prompts the user for data for up to 3 rows of data and 4 values in each row.
Then the changes will have to make to the code so that the data contains 8 rows of data, with 8 values on each row are as follows?
We can store the data for 8 x 8 matrixes. But we need to define the field such as address, city, and etc
We need to define and add the fields as same as the below (Name, Age, Level and Fees)
(12) 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: Smith,Bruce 22 1 12.00
============================================
Row 2: Brown,Peter 24 2 12.00
============================================
Row 3: Maison,Mark 38 3 6.00
============================================
Provide the changes to the code that you need to make to do this.
We need to set the number of cols is 4 and number of row is 3
Buy Development of Simple Menu Driven Program Answers Online
Talk to our expert to get the help with Development of Simple Menu Driven Program Answers to complete your assessment on time and boost your grades now
The main aim/motive of the management assignment help services is to get connect with a greater number of students, and effectively help, and support them in getting completing their assignments the students also get find this a wonderful opportunity where they could effectively learn more about their topics, as the experts also have the best team members with them in which all the members effectively support each other to get complete their diploma assignments. They complete the assessments of the students in an appropriate manner and deliver them back to the students before the due date of the assignment so that the students could timely submit this, and can score higher marks. The experts of the assignment help services at urgenthomework.com are so much skilled, capable, talented, and experienced in their field of programming homework help writing assignments, so, for this, they can effectively write the best economics assignment help services.