Question
  1. Declare and initialize 4 Constants for the course category weights:
    1. The weight of Homework will be 15%
    2. The weight of Tests will be 35%
    3. The weight of the Mid term will be 20%
    4. The weight of the Fin al will be 30%
      • Remember to name your Constants according to Java standards.
  2. Declare a variable to store the input for the number of homework scores and use a Scanner method to read the value from the Console.
  3. Declare two variables: one to act as a counter for the while loop condition and the other to hold the sum of the scores entered. Create a while loop with a condition to read in the scores.
    • Inside the while loop, increase your counter variable and add to your sum variable.
  4. Using only existing variables, calculate the homework average. No *magic numbers here - use those existing variables.
  5. Declare a variable to store the input for the number of test scores and use a Scanner method to read the value from the Console.
  6. Declare two variables: one to act as a counter for the while loop condition and the other to hold the sum of the scores entered. Create a while loop with a condition to read in the scores.
    • Inside the while loop, increase your counter variable and add to your sum variable.
  7. Using only existing variables, calculate the test average. No *magic numbers here - use those existing variables.
  8. Declare a variable to store the input for the mid-term exam score and use a Scanner method to read the value from the Console. No loop needed because there is only one score.
  9. Declare a variable to store the input for the fin al ex am score and use a Scanner method to read the value from the Console. No loop needed.
  10. Using only existing variables and constants, calculate the overall grade average. No *magic numbers here - use those existing variables and constants.  Grades are determined by category average * category weight for all four categories.
  11. Determine the letter grade that corresponds to the numerical grade average using an if/else decision statement. You will see that you need only write the conditions for some letter grades, while you must write the entire block of code for other letter grades. Make sure you have a choice for A, B, C, D, and F.
  12. Output the grade average using a printf statement to format your output (see Sample output).  
  13. Output the letter grade (see Sample output).
  14. Determine the final message to output using an if/else statement. Students should only advance to the next course if their grade is an A, B, or C. Otherwise they must repeat the course.

Decisions and Loops The following are sample runs of the program to help you write your code and format your output: Sample O8 9 10 11 public class GradeCalculator { /** * @param args not used */ public static void main (String[] args) { //Declare co//Add to sum and increase counter } //Calculate test average System.out.println(); // Get midterm exam score from the user. S//Display the letter grade. //Output appropriate message using if/else { 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 00 Syst

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE IN JAVA:

import java.util.Scanner ;
public class TestScores {

   public static void main(String[] args) {
       int homeworkWeight = 15, testWeight = 35, midWeight = 20, finalWeight = 30 ;
       Scanner sc = new Scanner(System.in);
       System.out.print("How many homework scores to enter? ");
       int numberOfHomeworks = sc.nextInt();
       int i = 1 ;
       double homeworkScore, totalHomeworkScores = 0, homeworkAvg ;
       while(i <= numberOfHomeworks) {
          
           System.out.print("Enter homework score #" + i + ": ");
           homeworkScore = sc.nextDouble();
           totalHomeworkScores += homeworkScore ;
           i += 1 ;
       }
       homeworkAvg = totalHomeworkScores / numberOfHomeworks ;
       System.out.print("How many test scores to enter? ");
       int numberOfTestScores = sc.nextInt();
       i = 1 ;
       double testScore, totalTestScores = 0, testScoreAvg ;
       while(i <= numberOfTestScores) {
          
           System.out.print("Enter test score #" + i + ": ");
           testScore = sc.nextDouble();
           totalTestScores += testScore ;
           i += 1 ;
       }
       testScoreAvg = totalTestScores / numberOfTestScores ;
       System.out.print("Enter Mid score: ");
       double mid = sc.nextDouble();
       System.out.print("Enter Final score : ");
       double finalEx = sc.nextDouble();
      
       double finalScore = (homeworkAvg * homeworkWeight / 100) + (testScoreAvg * testWeight / 100) + (mid * midWeight / 100) + (finalEx * finalWeight / 100);
       System.out.println("Grade Average: " + finalScore);
       if(finalScore >= 90) {
           System.out.println("Letter grade : A");
           System.out.println("Good job! You can advance to the next course.");
       }
       else if(finalScore >= 80) {
           System.out.println("Letter grade : B");
           System.out.println("Good job! You can advance to the next course.");
       }
       else if(finalScore >= 70) {
           System.out.println("Letter grade : C");
           System.out.println("Good job! You can advance to the next course.");
       }
       else if(finalScore >= 60) {
           System.out.println("Letter grade : D");
           System.out.println("I'm sorry. You will have to repeat the course before advancing.");
       }
       else {
           System.out.println("Letter grade : F");
           System.out.println("I'm sorry. You will have to repeat the course before advancing.");
       }
       sc.close();
   }

}

OUTPUT:

<terminated > TestScores [Java Application] C:\Program Files\Java\jdk-13.0.1\bin\javaw.exe (25-Oct-2020, 2:13:37 am) How many

Add a comment
Know the answer?
Add Answer to:
Declare and initialize 4 Constants for the course category weights: The weight of Homework will be...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • this code is not working for me.. if enter 100 it is not showing the grades...

    this code is not working for me.. if enter 100 it is not showing the grades insted asking for score again.. #Python program that prompts user to enter the valuesof grddes . Then calculate the total scores , #then find average of total score. Then find the letter grade of the average score. Display the #results on python console. #grades.py def main(): #declare a list to store grade values grades=[] repeat=True #Set variables to zero total=0 counter=0 average=0 gradeLetter='' #Repeat...

  • Finish the given ProcessFile.java program that prompts the user for a filename and reprompts if file...

    Finish the given ProcessFile.java program that prompts the user for a filename and reprompts if file doesn’t exist. You will process through the file skipping any text or real (double) numbers. You will print the max, min, sum, count, and average of the integers in the file. You will want to create test files that contain integers, doubles, and Strings. HINT: Use hasNextInt() method and while loop. You may also want to use Integer.MAX_VALUE and Integer.MIN_VALUE for the initialization of...

  • Write a grading program for the following grading policies:- a. There are two quizzes, each graded...

    Write a grading program for the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:- >90 A >=80 and <90 B...

  • Write a grading program in Java for a class with the following grading policies: There are...

    Write a grading program in Java for a class with the following grading policies: There are three quizzes, each graded on the basis of 10 points. There is one midterm exam, graded on the basis of 100 points. There is one final exam, graded on the basis of 100 points. The final exam counts for 40% of the grade. The midterm counts for 35% of the grade. The three quizzes together count for a total of 25% of the grade....

  • In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each gr...

    In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:-...

  • Professor Dolittle has asked some computer science students to write a program that will help him...

    Professor Dolittle has asked some computer science students to write a program that will help him calculate his final grades. Professor Dolittle gives two midterms and a final exam. Each of these is worth 100 points. In addition, he gives a number of homework assignments during the semester. Each homework assignment is worth 100 points. At the end of the semester, Professor Dolittle wants to calculate the median score on the homework assignments for the semester. He believes that the...

  • Test Scores and Grade Write a program that has variables to hold three test scores. The...

    Test Scores and Grade Write a program that has variables to hold three test scores. The program should ask the user to enter three test scores and then assign the values entered to the variables. The program should display the average of the test scores and the letter grade that is assigned for the test score average. Use the grading scheme in the following table: Test Score Average Letter Grade 90–100 A 80–89 B 70–79 C 60–69 D Below 60...

  • using if/switch statements (C++) Write a grading program for a class with the following grading policies:...

    using if/switch statements (C++) Write a grading program for a class with the following grading policies: There are two quizzes, each graded on the basis of 10 points There is one midterm exam and one final exam, each graded on the basis of 100 points The final exam counts for 50% of the grade, the midterm counts for 25% and the two quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores. They should...

  • Java debugging in eclipse package edu.ilstu; import java.util.Scanner; /** * The following class has four independent...

    Java debugging in eclipse package edu.ilstu; import java.util.Scanner; /** * The following class has four independent debugging * problems. Solve one at a time, uncommenting the next * one only after the previous problem is working correctly. */ public class FindTheErrors { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); /* * Problem 1 Debugging * * This problem is to read in your first name, * last name, and current year and display them in *...

  • Need code written for a java eclipse program that will follow the skeleton code. Exams and...

    Need code written for a java eclipse program that will follow the skeleton code. Exams and assignments are weighted You will design a Java grade calculator for this assignment. A user should be able to calculate her/his letter grade in COMS/MIS 207 by inputting their scores obtained on worksheets, assignments and exams into the program. A skeleton code named GradeCompute.java containing the main method and stubs for a few other methods, is provided to you. You must not modify/make changes...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT