Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Program #2 (50 points): Write a java program (named AverargeGardes.java) as follows. The main method of the program prompts the user to enter number

JAVA

Program #2 (50 points): Write a java program (named AverargeGardes.java) as follows. The main method of the program prompts the user to enter number of students in a class (class size is

integer), then it prompts the user to enter the grades (between 0 and 100) into an array of type integer. The entered class size determines the array size. Next, the main method passes the filled array to another method, named findAverage(...). Method findAverage(...)recursively determines and returns the class average as a double value. Again, method findAverage(...)is a recursive method. Format the outputs as shown below. Shown input values are just for illustration.

Integrate the following simple menu in the program with these options:

 --------MAIN MENU------- 
 1. Read class size 2. Read class grades 3. Compute class average 4. Exit program 
 Enter option number: 

Always re-display the menu after an option (other than option 4) is fully exercised with blank lines before and after the menu.

Do Not hard-code test data in the code. Test data is entered using the menu options. Do Not use output labels as input prompts. Test data below does not show input prompts, only outputs. Test your code with the following sample inputs and format the output as shown below. Notice how output values are lined-up after the labels.

 You entered class size: 3 You entered grades: 100 100 100 Class average:100.00 
 You entered class size: 7 You entered grades: 50 75 80 80 40 35 85 Class average: 63.57 
 You entered class size: 8 You entered grades: 0 100 25 90 55 30 90 35 Class average: 53.13

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

9. What is the function of copy in an advertising message?

Answered: 1 week ago

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago