Program Requirements And Algorithm

Step-by-step Algorithm for the Program

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.

Don't use plagiarized sources. Get Your Custom Essay on
Program Requirements And Algorithm
Just from $13/Page
Order Essay

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.

Option 1 – Read User Input and Store Data

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

What Will You Get?

We provide professional writing services to help you score straight A’s by submitting custom written assignments that mirror your guidelines.

Premium Quality

Get result-oriented writing and never worry about grades anymore. We follow the highest quality standards to make sure that you get perfect assignments.

Experienced Writers

Our writers have experience in dealing with papers of every educational level. You can surely rely on the expertise of our qualified professionals.

On-Time Delivery

Your deadline is our threshold for success and we take it very seriously. We make sure you receive your papers before your predefined time.

24/7 Customer Support

Someone from our customer support team is always here to respond to your questions. So, hit us up if you have got any ambiguity or concern.

Complete Confidentiality

Sit back and relax while we help you out with writing your papers. We have an ultimate policy for keeping your personal and order-related details a secret.

Authentic Sources

We assure you that your document will be thoroughly checked for plagiarism and grammatical errors as we use highly authentic and licit sources.

Moneyback Guarantee

Still reluctant about placing an order? Our 100% Moneyback Guarantee backs you up on rare occasions where you aren’t satisfied with the writing.

Order Tracking

You don’t have to wait for an update for hours; you can track the progress of your order any time you want. We share the status after each step.

image

Areas of Expertise

Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.

Areas of Expertise

Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.

image

Trusted Partner of 9650+ Students for Writing

From brainstorming your paper's outline to perfecting its grammar, we perform every step carefully to make your paper worthy of A grade.

Preferred Writer

Hire your preferred writer anytime. Simply specify if you want your preferred expert to write your paper and we’ll make that happen.

Grammar Check Report

Get an elaborate and authentic grammar check report with your work to have the grammar goodness sealed in your document.

One Page Summary

You can purchase this feature if you want our writers to sum up your paper in the form of a concise and well-articulated summary.

Plagiarism Report

You don’t have to worry about plagiarism anymore. Get a plagiarism report to certify the uniqueness of your work.

Free Features $66FREE

  • Most Qualified Writer $10FREE
  • Plagiarism Scan Report $10FREE
  • Unlimited Revisions $08FREE
  • Paper Formatting $05FREE
  • Cover Page $05FREE
  • Referencing & Bibliography $10FREE
  • Dedicated User Area $08FREE
  • 24/7 Order Tracking $05FREE
  • Periodic Email Alerts $05FREE
image

Our Services

Join us for the best experience while seeking writing assistance in your college life. A good grade is all you need to boost up your academic excellence and we are all about it.

  • On-time Delivery
  • 24/7 Order Tracking
  • Access to Authentic Sources
Academic Writing

We create perfect papers according to the guidelines.

Professional Editing

We seamlessly edit out errors from your papers.

Thorough Proofreading

We thoroughly read your final draft to identify errors.

image

Delegate Your Challenging Writing Tasks to Experienced Professionals

Work with ultimate peace of mind because we ensure that your academic work is our responsibility and your grades are a top concern for us!

Check Out Our Sample Work

Dedication. Quality. Commitment. Punctuality

Categories
All samples
Essay (any type)
Essay (any type)
The Value of a Nursing Degree
Undergrad. (yrs 3-4)
Nursing
2
View this sample

It May Not Be Much, but It’s Honest Work!

Here is what we have achieved so far. These numbers are evidence that we go the extra mile to make your college journey successful.

0+

Happy Clients

0+

Words Written This Week

0+

Ongoing Orders

0%

Customer Satisfaction Rate
image

Process as Fine as Brewed Coffee

We have the most intuitive and minimalistic process so that you can easily place an order. Just follow a few steps to unlock success.

See How We Helped 9000+ Students Achieve Success

image

We Analyze Your Problem and Offer Customized Writing

We understand your guidelines first before delivering any writing service. You can discuss your writing needs and we will have them evaluated by our dedicated team.

  • Clear elicitation of your requirements.
  • Customized writing as per your needs.

We Mirror Your Guidelines to Deliver Quality Services

We write your papers in a standardized way. We complete your work in such a way that it turns out to be a perfect description of your guidelines.

  • Proactive analysis of your writing.
  • Active communication to understand requirements.
image
image

We Handle Your Writing Tasks to Ensure Excellent Grades

We promise you excellent grades and academic excellence that you always longed for. Our writers stay in touch with you via email.

  • Thorough research and analysis for every order.
  • Deliverance of reliable writing service to improve your grades.
Place an Order Start Chat Now
image

Order your essay today and save 30% with the discount code Happy