java programming project
. Name the class file Grades.java
2. Use methods to avoid redundancy. In addition to the main method, you should have 7 additional methods (see below for more info on each method):
PART 1:
- Immediately following the opening { of the Grades Class, declare the Scanner instance variable as:
- private static Scanner console;
- **This is different than the text where they pass the console to each method! By doing this, it will allow you to use the Scanner console anywhere in your program – just like a Java Constant – without having to re-declare of pass it.
- Inside the main method, initialize your console as a new Scanner (console = new Scanner(System.in)).
- Write a giveIntro method, and output a greeting (print(ln) to the user that looks like the Sample Output
- Call the giveIntro() method from main method
PART 2:
- In the main method, prompt the user to input values for category weights of Homework, Quizzes, and Tests (not Final exam – see below)
- Use the Scanner object, console, to read in the user’s input for each and store in appropriately named variables. Category weights should be ints.
- NOTE: The final exam weight should not be decided by the user. Start with 100 and subtract the other categories from 100 to obtain the final exam weight (or our calculations won’t be correct). Store this final exam weight in a variable and output to the user. See sample output. Please move to Part 3.
PART 3:
- Write a getHomeworkAvg method that does not take any parameters.
- Prompt the user for how many grades they will enter and store the response in a count variable.
- Declare a sum variable and initialize to 0.
- Use a for loop and the count variable to:
- Prompt the user for a grade (be specific “Grade 1”, “Grade 2”, etc). You can do this by using your ‘i’ counter variable inside your prompt (see 4.2 p.261)
- Add this value to the sum (this is the cumulative sum we studied – see 4.2 p. 261)
- Calculate the homework average (sum / count)
- Return the homework average from the method
- ***NOTE: We will not call this method from main method (more on this in Part 7). Please move to Part 4.
PART 4:
- Write a getQuizAvg method that does not take any parameters.
- Use what you learned in the getHomeworkAvg method to complete like the sample output above. (it is almost the same!)
- Return the Quiz average from the method.
- ***NOTE: We will not call this method from main method (more on this in Part 7). Please move to Part 5.
PART 5:
- Write a getTestAvg method that does not take any parameters.
- Use what you learned in the getHomeworkAvg and getQuizAvg methods to complete (it is almost the same!).
- Return the Test average from the method.
- ***NOTE: We will not call this method from main method (more on this in Part 7). Please move to Part 6.
PART 6:
- Write a getFinalExamGrade method that does not take any parameters.
- NO FOR loop needed because we only have one final exam grade – just ask the user for the final exam grade and return it from the method.
- Return the final exam grade from the method.
- ***NOTE: We will not call this method from main method (more on this in Part 7). Please move to Part 7.
PART 7:
- Write a calculateFinalGrade method that takes 4 parameters for weight categories that you created in the main method
- Use an IF statement to THROW and IllegalArgumentException if any of the parameters is less than 0.
- Use the 4 weights and method calls to the above methods to calculate the final grade average
- ***NOTE: You can call other methods from this method!!
- EX: If you call getHomeworkAvg method, it will return the HW average value TO the calculateFinalGrade method and you can use it.
- So to obtain the averages for each category, you will call the 4 methods you created in Parts 3 – 6, and these average values will be sent (returned) back to the calculateFinalGrade method.
- ***NOTE: You can call other methods from this method!!
- Grades are calculated by adding: weight * avg for all categories and dividing this sum by 100
- For example, to calculate grades for our 1301 class, I would do this:
- (ParticipationAvg * 10 + QuizAvg * 15 + ProjectAvg * 30 + MidtermExam * 20 + FinalExam * 25) / 100
- Return the final grade average from the method. Please move to Part 8.
PART 8:
- Write a getFinalLetterGrade method that takes in one parameter, finalGrade, for the final grade average that was calculated in Part 7.
- Use an IF statement to THROW an IllegalArgumentException if the finalGrade paramter is less than 0.
- Use an if/else statement to test whether the finalGrade parameter is equal to an A, B, C, D, or F
- Inside the if/else statment, return a String that matches the sample output above (do NOT use println statements here!)
- EX: 92.5 would return “Great job – You earned an A”
- EX: 85 would return: “Good job – You earned a B”
- Use appropriate (and different!) responses for C, D, and F
- Please move to Part 9
PART 9:
**Please go back to the main method
- Call the calculateFinalGrade method, passing your 4 parameters, and store this return value in a variable called finalGrade.
- Use printf to output the final grade average with two decimal places
- Use the finalGrade average variable you created above and a print(ln) statement to call the getFinalLetterGrade method
YOUR DONE!!! GREAT JOB! 🙂
Continue to use good java programming style and include comments at the top of your class as well as above each method. Please see the Java Coding Guidelines and Rubric for more details.
**We will now add the @precondition tag to our methods to describe the conditions on the parameter. (EX: grades must be between 0 and 100)
SAMPLE OUTPUT IS IN LINK BELOW
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!
NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.

