Question: This assignment will provide you with practice using Java variables and expressions, if/else statements, Scanner objects for interactive programming, and methods in the Math class.

This assignment will provide you with practice using Java variables and expressions, if/else statements, Scanner objects for interactive programming, and methods in the Math class.

Users will provide some information about their performance during the semester, and the program will output the students' weighted semester average according to some rules that follow.

The Program

You will write a Java class called Grades that should be saved into a file called Grades.java.

Your program will read in grades for a student in a fictional course, and it will calculate the overall course grade for the student. Below is one example log of execution of the program (user input is underlined for the sake of clarity in the log --- you do not need to duplicate this behavior).

The course grade is a weighted average of three components: a homework grade, an exa m 1 grade, and an exa m 2 grade. To compute a weighted average, the student's point scores for each component are divided by the total points for that component and multiplied by that component's weight.

The homework score is determined by the student's average score on a series of assignments, as well as points for attending labs. Homeworks are worth 10 points, and each lab is worth 4 points, and the number of homeworks and labs is the same. The number of assignments is entered by the user, as is the student's average homework score and the number of labs attended, as shown in the execution log. If a student hands an assignment in late, he or she uses "late days." For this course, if the student uses more late days than half the number of assignments, the assignment grade should be reduced by 10%. If the student uses no late days, the student should get 5 extra credit points for the homeworks. However, a student cannot earn more points than the maximum available for homeworks; a student that averages 10 points per assignment and never hands any in late has already earned the maximum number of homework points and will get no extra credit for being punctual.

Exams are worth 100 points each, and potentially are curved by adding some "curve points" to every students' grade. However, students cannot earn more than 100 points on an exa m.

Your program should be careful to correct bad numeric values entered by the user. If a user enters a negative number or zero for the number of assignments, the student should get full credit for the homework grade. If a user enters a negative number for the average homework grade or an exa m grade, it should be treated like a zero. If a user enters a higher score than the maximum number of points available for homeworks or an exa m, the score should be capped.

In the log of execution shown, the course has 50% weight for homework, 20% weight for exa m 1, and 30% weight for exa m 2. There are 10 homework assignments. The student attended 4 labs (earning 16 points for doing so). The student received an exa m 1 score of 81. The student earned an exa m 2 score of 95; the exa m was curved by +10 points, but exa m scores are capped at 100, so the student was given 100 for exa m 2.

The following calculations produce the student's course grade from the above log of execution:

 grade = weightedHomeworkScore + weightedExam1Score + weightedExam2Score weightedHomeworkScore = 50 * (8.45 * 10 + 4 * 4) / (10 * 10 + 4 * 10) weightedExam1Score = 20 * 81 / 100 weightedExam2Score = 30 * 100 / 100 

Note that the preceding equations are not Java math. In Java, an integer expression such as 81/100 would evaluate to 0, but above the value intended is 0.81.

When the program asks the user for the weights of the three components, it only asks for weights for homework and exa m 1. Using this information, the program can deduce the weight of exa m 2 as 100 minus the other two weights.

Stylistic Guidelines

Break the larger problem up into small, manageable methods. In your comments, be clear about what is passed to each method and what is returned.

When handling numeric data, you are expected to choose appropriately between types int and double.

Please indent your code and use whitespace to make your program readable. Give meaningful names to variables in your code. Follow Java's naming and capitalization standards.

Include a comment at the beginning of your program with basic information and a description of the program, and a brief comment for each of your defined methods.

for exampe the answer should be like this:

This program accepts your homework and two exa m scores as input and computes your grade in the course. 
 Homework weight? 50 Exa m 1 weight? 20 Using weights of 50 20 30 Homework: 
 Number of assignments? 10 Average Homework grade? 8.45 Number of late days used? 2 Labs attended? 4 
 Total points = 100.5 / 140 Weighted score = 35.89 Exa m 1: Score? 81 
 Curve? 0 Total points = 81 / 100 Weighted score = 16.2 Exa m 2: Score? 95 
Curve? 10 Total points = 100 / 100 Weighted score = 30.0 Course grade = 82.09 

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 Databases Questions!