Explain how the loop displaying the menu

Assignment Help JAVA Programming
Reference no: EM13114964

Design Constraints

Your program should confirm to the following constraints.  It should:

  • include at least one example of the successful and appropriate use of :
    • a two-dimensional array containing numbers or characters
    • a switch statement
    • an if statement
    • a while-loop
    • a do-while loop
    • a for-loop
  • ensure that your program can 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 enteredie if you are expecting the user to enter data of type int that this will be the case.
  • use appropriate formatting and programming styles (ie naming, formatting and commenting of code)
  • successfully compiles in Eclipse without any warnings. 

You may add additional functionality to your program, however, you must necessarily complete the above requirements.

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.

Part A - Code Comprehension

Sample code has been provided 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 is exited, what value does menuSel have when the program finishes? Describe what happens next when menuSel gets this value.

3. The reserved word breakis used in the switch-statement to manage the menu selection.  What is the purpose of the breakstatement? 

4.  Currently, if the user enters an incorrect menu selection (such as 5) what happens?  How could the switch-statement be altered to allow for an error message to be displayed

5.  What alternative loop could have been used for the main controlling loop (i.e. the do-while)? 

6. 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.

7.  The variable done is declared as a boolean.  Explain what would happen if the code in the do-while loop was changed to:

while(done=true);

8. Currently, menu item one prompts the user for data for Competitor 0 up to Competitor 4.  What change would you have to make to the code so that displays Competitor 1 to Competitor 5?

9. The design of the output in for menu selection 2 needs to be changed so that it displays the scores as per the following:

Competitor 1:        1      1      1      1      1

===============================================

Competitor 2:        2      2      2      2      2

===============================================

Competitor 3:        3      3      3      3      3

===============================================

Competitor 4:        4      4      4      4      4

===============================================

Competitor 5:        5      5      5      5      5

===============================================

Provide the changes to the code that you need to make to do this.

10.  Explain how the nested for-loop in menu item 2 could be altered so that the user could specify how many competitors and how many judges to use up to the maximum values?  For example, the maximum number of judges is 5 but the user of the program indicates that only 3 judges will be used for this competition.

If you have used any resources (books, websites, etc) you do need to cite and reference this material appropriately.

Part B- Program Requirements

The first part of the assignment is to provide the requirements of the 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 some form of data
  • View reports - at least two different reports (e.g. average result, average score)
  • Quit the system

Your requirements should allow your program to conform to the design constraints listed above.

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- Analysis and Design

Design a program for the task you have specified in Part A. You should include:

  1. An analysis of the problem
  2. High level pseudo-code
  3. Test data

Once you have completed your pseudo-code perform a desk check. 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.

Part D - Implementation and Development

Using design developed in Part B implement the program in Java.  You could beusing 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 B, test your program to ensure that it works as specified and that there are no logic errors in your code. 

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.

Download:- java programm.rar

Reference no: EM13114964

Questions Cloud

Break-even point-dependent and independent : Would you please show us the calculation of following problem for breakeven point below? Suppose that a company has fixed costs of $150,000 and variable costs of $7.5 per unit. What is the break-even point if the selling price is $12.5 per unit?
Explain if crosby and dash are in disagreement : Explain if crosby and dash are in disagreement as to the exact amount of money that crosby owes dash, then they may choose to form a new agreement at a set amount.
Illustrate what is the velocity of the current : Because of your knowledge of physics, you head your boat 44° west of north and have a velocity of 8.0 m/s due north relative to the shore. Illustrate w hat is the velocity of the current? What is your speed relative to the water.
Predetermine overhead rate : ZXC Firm has the following information to determine Predetermine overhead rate for Standard Costing:
Explain how the loop displaying the menu : Explain how the loop displaying the menu is exited, what value does menuSel have when the program finishes? Describe what happens next when menuSel gets this value.
Clarify horizontal component of the pendulum displacement : A 15 g rifle bullet traveling 250 m/s buries itself in a 3.0 kg pendulum hanging on a 2.9 m long string, which makes the pendulum swing upward in an arc. Clarify the horizontal component of the pendulum's displacement.
Find the probability of selecting credit card customer : What is the probability of selecting a credit card customer at random and finding the customer charged between $70 and $83? compute the probability of charges less than $54.
Information regarding activity cost pools : You have given this information for ABC Corporation. What is the Activity Rate for the three Activity costs Pools?
Self awareness is an essential characteristic for leaders : The topic is "Self Awareness is an essential characteristic for successful leaders" Can you give me some main ideas about this topic so that I can analysis them and some references (if it's possible).

Reviews

Write a Review

JAVA Programming Questions & Answers

  Java program to read line of text which ends with period

Write down the java program which will read the line of text which ends with the period, which serves as sentinel value. Show all the letters which occur in the text.

  Develop java code to compute monthly rent for housing units

Develop a java code that computes monthly rent for 3 housing units namely Bungalows,Apartments and hostels. All housing units have got size,color and monthly rental rate.

  Write a java class

Write a Java class called PQueue that extends the provided abstract QueueADT class.

  Java problem - g queue

A queue is an ordered collection of items in which the removal of items is restricted to the FIFO ( rst in rst out) principle.

  Develop a graphical user interface based java program

Develop a Java program that can communicate with a real SMTP email server for sending emails. TNE 60003 - introduction to network programming, You program should provide a GUI and can successfully send the SMTP commands to the mail server

  Simulate a simple multiuser computer system

Prepare a java program to simulate a simple multiuser computer system

  Program to find maximum-minimum of sequence of values

Common task which should be done in loop is to find maximum and minimum of sequence of values. File Temps.java contains program which reads in sequence of hourly temperature readings over 24- hour period.

  Write java applet for costco gas station

Write a java applet for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use: grade 87, 89, or 91.

  Java method that contains code to be executed

Write a short Java method that contains code for which it is probably impossible for that code to ever be executed, but your favorite Java compiler does not detect this fact.

  Java application to display multiple choice questions

Write down the application which displays series of TEN(10) multiple choice questions: questions must cover all the Java. Each question must have four possible answers and only one answer must be correct.

  Methods

Assignment describe the basic working of methods. How to write a method in java and how to call a method.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd