Comp Sci Solving Grades.java Assignment: Weighted Grade Calculation

  • Thread starter Thread starter brgordon92
  • Start date Start date
  • Tags Tags
    Stuck
AI Thread Summary
The Grades.java assignment focuses on creating a Java program that calculates a student's overall course grade based on weighted averages from homework, midterm, and final exam scores. It requires the use of a Scanner for user input and emphasizes the importance of correctly implementing if/else statements and methods that return values. The program must prompt the user for weights and scores, compute weighted scores, and provide feedback on the final exam score needed to achieve a desired course grade. The expected output includes detailed prompts for input and calculations that guide the user through the grading process. This assignment serves as a practical exercise in interactive programming and grade calculation logic.
brgordon92
Messages
1
Reaction score
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
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?
 

Similar threads

Replies
1
Views
2K
Replies
3
Views
2K
Replies
17
Views
2K
Replies
1
Views
2K
Replies
36
Views
3K
Replies
1
Views
3K
Replies
8
Views
3K
Replies
1
Views
3K
Replies
1
Views
2K
Back
Top