Question: Test Average and Grade ( Methods Program ) : Write a program that asks the user to enter 5 test scores ( NO arrays! )

Test Average and Grade (Methods Program): Write a program that asks the user to enter 5 test scores (NO arrays!). Your program should then display a letter grade for each test score, the average test score and the overall letter grade for the average score.
Your program is required to have and use the following methods (these methods CAN NOT be void methods) for calculating the average score and giving the letter grade for EACH score including the average score:
calcAverage This method must accept 5 test scores as arguments and must return the average of the 5 scores (NOT A VOID METHOD).
determineGrade This method must accept a test score as an argument and must return a letter grade for the score it accepted as an argument (NOT A VOID METHOD).
Heres the grading scale:
Score
Letter Grade
90-100
A
80-89
B
70-79
C
60-69
D
Below 60
F
Conversion Program (using Methods, 20 pts): Write a program that converts meters to kilometers, inches, or feet depending on the users selection from a menu.
Your program is required to have the following 4 methods:
convertKilometers This must be a method that accepts the number of meters as an argument and returns the number of kilometers (NOT A VOID METHOD). Convert meters to kilometers using the following formula:
kilometers = meters *0.001
convertInches - This must be a method that accepts the number of meters as an argument and returns the number of inches (NOT A VOID METHOD). Convert meters to inches using the following formula:
inches = meters *39.37
convertFeet - This must be a method that accepts the number of meters as an argument and returns the number of feet (NOT A VOID METHOD). Convert meters to feet using the following formula:
feet = meters *3.281
showMenu this must be a void method that accepts no arguments (this one is void). It should display the following menu:
METER CONVERSION
1) Convert to Kilometers
2) Convert to Inches
3) Convert to Feet
4) Quit the Program
Please make a selection:
The program should run as follows:
The program should start (in the main method) by calling the showMenu method to display the menu. The program should then get the users selection (use int).
Once the program (main method) gets the users selection it should ask the user for a number of meters (assume double). Do input validation on the number of meters to prevent a negative number of meters. When valid, the number of meters the user enters will be passed as an argument into one of the methods depending on what the users selection was.
-If the user chose 1, the convertKilometers method should be called with the number of meters the user entered passed to it as an argument. The number of meters converted to kilometers should be returned to the main method.
-If the user chose 2, the convertInches method should be called with the number of meters the user entered passed to as an argument. The number of meters converted to inches should be returned to the main method.
-If the user chose 3, the convertFeet method should be called with the number of meters the user entered passed to it as an argument. The number of meters converted to kilometers should be returned to the main method.
Once the program (main method) receives the converted number of meters from the: convertKilometers, convertInches, or convertFeet method, it should display the results (format with 3 digits to the right of the decimal point).
Example output:
500 meters is .500 kilometers.
-The program should continue to run until the user selects 4 to quit the program. So the user should be able to make as many conversions as they would like (print invalid selection if not from 1 to 4).
-Input validation Again, do not allow the user to enter a negative number for the amount of meters.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!