Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is my code: HERE IS MY OUTPUT AND EXPECTED OUTPUT: PLEASE FIX MY CODE TO HAVE THOSE EXPECTED OUTPUT. THANKS YOU. 5.19 Programming Lab

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

Here is my code: image text in transcribed

HERE IS MY OUTPUT AND EXPECTED OUTPUT:

image text in transcribedimage text in transcribed

PLEASE FIX MY CODE TO HAVE THOSE EXPECTED OUTPUT. THANKS YOU.

5.19 Programming Lab 2: Grade Calculator With Methods This lab will be available until February 6th, 11:59 PM EST Instructor note: This Lab will be more challenging than Programming Lab 1. We need to start learning how to write "one large program" using all of the topics we have learned. This includes variables, Decisions, Loops, and Methods. Please read the instructions carefully. You may prefer to download the template, complete in an IDE, and copy and paste your solution. You will be required to put in proper Java commenting (10 pts), so please include. I will manually review your code and can deduct up to 10 pts. for comments or not following the program specifications. In this Programming Lab, we are going to learn how to use Methods to make our code more effective and handle "separation of concerns". Think of methods like functions - each method handles one specific problem or task, but is able to be called/reused as many times as needed. The purpose of this program is to prompt the student to input their grades for each category, find the student's grade average for each category, and use these averages to calculate the user's final grade average and letter grade. This is similar to Programming Lab 1, but with methods and loops. We will break our code down into several methods that each have one specific purpose. One to handle the homework grades, one to handle the test grades, one to handle the midterm grade, one to handle the final exam grade, and one to find the letter grade associated with the given numerical grade. Step 1: - A Scanner object in and constants have been declared for you in the main method inside the template code. Please leave these in. - We will return to the main method after writing all our methods. (This is common practice - write methods and then call them). Step 2: - Write a method getHomeworkAverage(Scanner in) that takes the Scanner object as a parameter and returns the homework average as type double. The method header and commenting has been written for you. - Inside this method, use a print statement to prompt the user for the number of grades to be entered for homework. - Write a method getHomeworkAverage(Scanner in) that takes the Scanner object as a parameter and returns the homework average as type double. The method header and commenting has been written for you. - Inside this method, use a print statement to prompt the user for the number of grades to be entered for homework. - Declare a count variable as integer and store the input. - Declare a sum variable and initialize to 0. - Use a for loop that counts from 0 up to count. - Inside the for loop, use a print statement to prompt the user for the individual grades. - Read in the input and add it to the sum. - Outside of the for loop, create a variable homeworkAverage and store the calculated average in the variable (averages are total sum / count). - return the homework average from the method. Example of getHomeworkAverage method executing: How many homework grades to be entered?: 4 Grade 1: 78.6 Grade 2: 89 Grade 3:76.4 Grade 4: 91 Step 3: - Write a method getTestaverage(*parameter here*) that returns a double. Follow the same instructions in Step 2 to read in a user's test grades and calculate the average. Remember to return the test average and comment your method above the method with @ tags, as needed. Example of getTestAverage method executing: How many tests grades to be entered?: 2 Grade 1: 78.9 Grade 2: 88 Step 4: - Write a method getMidtermExamGrade(*parameter here*) that returns a type double. - Inside this method, prompt the user to enter their midterm exam grade (no for loop needed as only one score can be entered) and store the input. - return the midterm exam grade. - Write a method getMidtermExamGrade(*parameter here*) that returns a type double. - Inside this method, prompt the user to enter their midterm exam grade (no for loop needed as only one score can be entered) and store the input. - return the midterm exam grade. Example of getMidtermExamGrade method executing: Please enter your midterm exam grade: 82.3 Step 5: - Write a method getFinalExamGrade(*parameter here*) that returns a type double. - Inside this method, prompt the user to enter their final exam grade (no for loop needed as only one score can be entered) and store the input. - return the final exam grade. Example of getFinalExamGrade method executing: Please enter your final exam grade: 90.1 Step 6: - Write a method getLetterGrade(*parameter here*) that takes a numerical finalGrade as a parameter and returns a String. - Inside this method, the String variable letterGrade has been declared for you. - Use an if/else if/else statement to check if the finalGrade is an A, B, C, D, or F. We will use a 10-point scale where >= 90 is an A,>=80 is a B, etc. - Inside each if/else statement, assign a String "Course grade: X ", where X is the letter grade. - return the letter grade. - **NOTE: Please make sure you are not *printing the String in this method. We will print it in the main method. Example of getLetterGrade method executing: Step 7: - Return back to the main method. - Call the 4 methods for homework, tests, midterm, and final, passing the Scanner object as a parameter to each. Make sure to store the return values in appropriate variables. Step 7: - Return back to the main method. - Call the 4 methods for homework, tests, midterm, and final, passing the Scanner object as a parameter to each. Make sure to store the return values in appropriate variables. - Calculate the final numerical grade average using the variables and the constants that were declared above (grade average is the sum of all of the averages * CONSTANT) - Use a printf statement to output the final grade average to 2 decimal places. - Call the getLetterGrade method, passing the final grade average as a parameter. - Use a println statement to output the letter grade. Entire run of program in an IDE (this is formatted): How many homework grades to be entered?: 4 Grade 1: 78.6 Grade 2: 89 Grade 3:76.4 Grade 4: 91 How many tests grades to be entered?: 2 Grade 1: 78.9 Grade 2: 88 Please enter your midterm exam grade: 82.3 Please enter your final exam grade: 90.1 Your final grade is: 85.16 Course grade: B Remember to comment your code per the "Java Coding RULES" doc in iCollege (10 pts). NOTE: The output in zyLabs will not show the formatting in the testing output. It will appear as one long run-on sentence. Therefore, I recommend downloading the given template, writing the program in your IDE, and then copy and paste back over. How many homework grades to be entered?: Grade 1: Grade 2: Grade 3: Grade 4: How many tests grades to be entered?: Grade 1: Grade 2: Please enter your midterm exam grade: Please enter your final exam grade: Your final grade is: 85.16 Course grade: B The input in zyLabs is of the form: 478.68976.491 Input 2:Compare output 0/30 Output differs. See highlights below. Output differs. See highlights below. 4:Compare output 4 0/20 Output differs. See highlights below

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

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions