1. Mar 27, 2013

### brgordon92

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

EXPECTED OUTPUT
This program accepts your homework and exam
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 static void main(String[] args) {
giveIntro();
Scanner console = new Scanner(System.in);
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("the course or indicates what grade you need");
System.out.println("to earn on the final exam.");
System.out.println();
}

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;
}

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;
}
}

2. Mar 27, 2013