Solving Grades.java Assignment: Weighted Grade Calculation

  • Comp Sci
  • Thread starter brgordon92
  • Start date
  • Tags
    Stuck
In summary, this conversation discusses an assignment that requires practice with interactive programs, if/else statements, and methods that return values. The assignment involves creating a Java class named Grades and using a Scanner object for console input. The program calculates a student's overall course grade by using their grades on homework, a midterm exam, and a final exam, which are weighted based on their respective categories. It also provides an example of how to compute a weighted average and gives an expected output for the program.
  • #1
brgordon92
1
0
This assignment will give you practice with interactive programs, if/else statements, and methods that return
values. Turn in a Java class named Grades in a file named Grades.java. You will be using a Scanner object
for console input, so you will need to import java.util.*; into your program.
This program uses a student's grades on homework, a midterm exam, and a final exam to compute an overall
course grade. The course grade is a weighted average. To compute a weighted average, the student's point
scores in each category are divided by the total points for that category, then multiplied by that category's
weight. (The sum of all categories' weights should be 100.)

Example: A course has 50% weight for homework, 20% weight for its midterm, and 30% weight for its final.
There are 3 homework assignments worth 15, 20, and 25 points respectively. The student received homework
scores of 10, 16, and 19, a midterm score of 81, and a final exam score of 73 (which was curved by +5 points to
make a curved score of 78).

This program asks the user to enter his/her grades on homework, a midterm exam, and (optionally) a final
exam. Using this information, the program can either compute the student's overall course grade (if the student
has taken the final exam) or tell the student what score he/she needs to earn on the final exam to achieve a
certain grade in the class.

EXPECTED OUTPUT
This program accepts your homework and exam
scores as input, and computes your grade in
the course or indicates what grade you need
to earn on the final exam.
Homework:
What is its weight (0-100)? 50
How many homework assignments were there? 3
Homework 1 score and max score: 14 15
Homework 2 score and max score: 18 20
Homework 3 score and max score: 19 25
Weighted homework score: 42.5
Midterm exam:
What is its weight (0-100)? 20
Exam score: 81
Was there a curve? (1 for yes, 2 for no) 2
Weighted exam score: 16.2
Final exam:
Have you taken the final exam yet? (1 for yes, 2 for no) 2
What is its weight (0-100)? 30
What percentage would you like to earn in the course? 80
You need a score of 71.0 on the final exam.

my work so far:

import java.util.*; // for Scanner

// This program prompts the user to enter various student scores
// and outputs the student's grade in the course.
public class Grades {public static void main(String[] args) {
giveIntro();
Scanner console = new Scanner(System.in);
int Grade ;
double weightedScore = weightedScore(weight, score, curveNumber);
double weightedScore = weightedScore2(weight2, sections, sumScore);
}

// a welcome message to start the program
public static void giveIntro() {
System.out.println("This program accepts your homework and exam");
System.out.println("scores as input and,computes your grade in");
System.out.println("the course or indicates what grade you need");
System.out.println("to earn on the final exam.");
System.out.println();
}

// asks about student's homeworks and returns weighted HW score
public static void getHomeworkScores() {
System.out.print("What is its weight (0-100)?");
double weight = console.nextInt();
}

public static double homework(int weight) {

return 0.0;
}

// asks about student's exam and returns weighted exam score
public static double exam(Scanner console, int number, int weight)
{
return 0.0;
}

// helper method to compute and print a weighted category score
public static double weightedScore(int weight, int earned, int
possible) {
return 0.0;
}

// returns the given double value rounded to the nearest hundredth
public static double round2(double number) {
return Math.round(number * 100.0) / 100.0;
}
}
 
Physics news on Phys.org
  • #2
brgordon92 said:
This assignment will give you practice with interactive programs, if/else statements, and methods that return
values. Turn in a Java class named Grades in a file named Grades.java. You will be using a Scanner object
for console input, so you will need to import java.util.*; into your program.
This program uses a student's grades on homework, a midterm exam, and a final exam to compute an overall
course grade. The course grade is a weighted average. To compute a weighted average, the student's point
scores in each category are divided by the total points for that category, then multiplied by that category's
weight. (The sum of all categories' weights should be 100.)

Example: A course has 50% weight for homework, 20% weight for its midterm, and 30% weight for its final.
There are 3 homework assignments worth 15, 20, and 25 points respectively. The student received homework
scores of 10, 16, and 19, a midterm score of 81, and a final exam score of 73 (which was curved by +5 points to
make a curved score of 78).

This program asks the user to enter his/her grades on homework, a midterm exam, and (optionally) a final
exam. Using this information, the program can either compute the student's overall course grade (if the student
has taken the final exam) or tell the student what score he/she needs to earn on the final exam to achieve a
certain grade in the class.

EXPECTED OUTPUT
This program accepts your homework and exam
scores as input, and computes your grade in
the course or indicates what grade you need
to earn on the final exam.
Homework:
What is its weight (0-100)? 50
How many homework assignments were there? 3
Homework 1 score and max score: 14 15
Homework 2 score and max score: 18 20
Homework 3 score and max score: 19 25
Weighted homework score: 42.5
Midterm exam:
What is its weight (0-100)? 20
Exam score: 81
Was there a curve? (1 for yes, 2 for no) 2
Weighted exam score: 16.2
Final exam:
Have you taken the final exam yet? (1 for yes, 2 for no) 2
What is its weight (0-100)? 30
What percentage would you like to earn in the course? 80
You need a score of 71.0 on the final exam.

my work so far:

import java.util.*; // for Scanner

// This program prompts the user to enter various student scores
// and outputs the student's grade in the course.
public class Grades {


public static void main(String[] args) {
giveIntro();
Scanner console = new Scanner(System.in);
int Grade ;
double weightedScore = weightedScore(weight, score, curveNumber);
double weightedScore = weightedScore2(weight2, sections, sumScore);
}

// a welcome message to start the program
public static void giveIntro() {
System.out.println("This program accepts your homework and exam");
System.out.println("scores as input and,computes your grade in");
System.out.println("the course or indicates what grade you need");
System.out.println("to earn on the final exam.");
System.out.println();
}

// asks about student's homeworks and returns weighted HW score
public static void getHomeworkScores() {
System.out.print("What is its weight (0-100)?");
double weight = console.nextInt();
}

public static double homework(int weight) {

return 0.0;
}

// asks about student's exam and returns weighted exam score
public static double exam(Scanner console, int number, int weight)
{
return 0.0;
}

// helper method to compute and print a weighted category score
public static double weightedScore(int weight, int earned, int
possible) {
return 0.0;
}

// returns the given double value rounded to the nearest hundredth
public static double round2(double number) {
return Math.round(number * 100.0) / 100.0;
}
}

What's your question?
 

1. How do I calculate my weighted grade for this assignment?

To calculate your weighted grade for the Grades.java assignment, you will need to first gather the necessary information such as your grades for each category (exams, quizzes, homework, etc.) and the corresponding weight of each category. Then, you can use the weighted grade formula: (category 1 grade x category 1 weight) + (category 2 grade x category 2 weight) + ... + (category n grade x category n weight) = weighted grade. This will give you your final weighted grade for the assignment.

2. Can I use my own custom weight percentages for the categories?

Yes, you can use your own custom weight percentages for the categories as long as they add up to 100%. This will ensure that your final weighted grade is accurate. However, make sure to check with your professor or instructor beforehand to see if they have specified any specific weight percentages for the assignment.

3. What happens if I don't have a grade for one of the categories?

If you do not have a grade for one of the categories, you can either leave it as a 0 or leave it out of the calculation altogether. Just make sure to adjust the weight percentages accordingly to ensure that they still add up to 100%. If you are unsure, it is best to check with your instructor for clarification.

4. Is there a specific format I need to follow for entering my grades?

The format for entering your grades may vary depending on the instructions given by your instructor. However, a common format is to enter the grade as a number between 0 and 100. If you are unsure, it is always best to check with your instructor for specific guidelines.

5. Can I use this weighted grade calculation for other assignments?

Yes, you can use this weighted grade calculation for other assignments as long as the categories and their corresponding weight percentages are applicable. However, keep in mind that this calculation may not work for every assignment, so it is always best to check with your instructor for specific instructions.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
2
Replies
36
Views
2K
  • Programming and Computer Science
Replies
23
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Programming and Computer Science
Replies
4
Views
3K
Back
Top