Securing Higher Grades Costing Your Pocket? Book Your Assignment at The Lowest Price Now!

Development Of Simple Menu Driven Program Add in library

355 Download7 Pages 1,524 Words

Question

Project Specification
For this assignment you are required to specify, design, implement and test a menu driven program of your own design. You are to imagine that you are developing a prototype for entering the initial records of a system and providing reports from that system. For example you could design a program that supports entering membership details of a club or entering records of student grades within a class or any system you can imagine involving storing personal details in a two dimensional array. You are provided with 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.
 
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 3 is selected what is displayed? Explain what has happened?
2. When the program is run and menu item 1 is selected and then menu item 3 is selected what is displayed?
3. If the program is run, menu item 1 is selected and the user attempts to add in 4 members what will happen and why?
4. 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.
5. 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 3?
6. 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.
7. What alternative looping structure could have been used for the main while loop?
8. Explain the purpose of the boolean variable finished.
9. 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.
10. Explain what would happen (and why) if the code in the while loop was changed to: while(finished==true)
11. 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 8 rows of data, with 8 values on each row?
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.

 

 

Answer:

Program Requirements

  1. Number of Cols
  2. Number of Rows
  3. 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,

 
No input values are stored in two dimensional array. So no age data available message will be displayed 

(2) If we select the menu item 1, the following result will be displayed,
 
System displays the Selected Option value. Then read the number of rows and cols value

(3) If the program is run, menu item 1 is selected and the user attempts to add in 4 members then 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 variables
 
 
(5)
                If 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

 (6) 
 

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

 

Testing
 

 

Validation:
 

Reports

OR

At MyAssignmenthelp.com, we are committed to deliver quality assignment assistance in the fastest way possible. To make our service delivery fast, we have hired subject matter experts to work on different subject specific assignments. We have hired experts who owe in-depth knowledge in their respective subjects. As per their expertise, they provide geography assignment help, Physics assignment help, Strategic assignment help, history assignment help, art architecture assignment help and assistance with other subjects as well.

Most Downloaded Sample of Programing

168 Download2 Pages 309 Words

These Items Act As Barriers To Intercultural Communication

1. How do these items act as barriers to intercultural communication? Answer:  The communication barriers Linguistic, Cultural and Emotional act as barriers for...

Read More Tags: Australia Arlington Management Management University of New South Wales Management 
65 Download2 Pages 429 Words

The Asch And Milgram Experiments Assignment

A just and fair decision always reflects an objective process, however, not all decisions are fair and just because they have influences and impacts that is actuall...

Read More Tags: Australia Arlington Management Management University of New South Wales Management 
166 Download10 Pages 2,301 Words

Digital Forensic Case Study

Question - Write a case study on Digital Forensic methodology?     Contents Executive Summary. Introduction.       Global F...

Read More Tags: Australia Arlington Management Management University of New South Wales Management 
40 Download10 Pages 2,338 Words

Professional Skills For Information And Communication Technology Portfolio

  Table of Contents Introduction Week 3: Critical Thinking Week 5: SWOT analysis of presentation skills Week 7: Reflective Writing Week 11: Personal Ethi...

Read More Tags: Australia Arlington Management Management University of New South Wales Management 
90 Download16 Pages 3,848 Words

Role Of Information Technology On Services Of Aldermore Bank

Question-Write A report based on role of information technology of financial corporate sector company Aldermore bank?     Executive summary The report i...

Read More Tags: Australia Arlington Management Management University of New South Wales Management 
Next
Free plagiarismFree plagiarism check online on mobile
Have any Query?