Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

these programs must be done in JAVA plz, and provide psuedeo code for each(not comments). . use VALUE RETURNING METHODS unless otherwise specified For all

these programs must be done in JAVA plz, and provide psuedeo code for each(not comments).

. use VALUE RETURNING METHODS unless otherwise specified

For all Programs:

Submit your source code and pseudo code for these programs to Homework 8 Canvas drop box by the due date

Lab #8 Based on Chapter 5

  1. Test Average and Grade (Methods Program): Write a program that asks the user to enter 5 test scores. 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)

  • 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

  1. Conversion Program (using Methods): 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.

Once the program (main method) gets the users selection it should ask the user for a number of meters. The number of meters the user enters will then 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.

Example output:

500 meters is .5 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.

-Input validation Do not allow the user to enter a negative number

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions