Project #43405 - Java homework

Another Grading Program

 

Objective:

 

Write a class that will be used by a program driver to enter in grades that a student has earned and the prints out their final grade

  • First download the (Lab 12driver) and put that in your newly created project
  • Next create a class called Grader that DOES NOT HAVE a main method
  • Write a method called setQuiz1 that prompts the user to enter a number between 0 and 100.  If they enter a number other than this the program should prompt the user of the error and then exit. (System.exit(0))
  • Write a method called setQuiz2 that prompts the user to enter a number between 0 and 100.  If they enter a number other than this the program should prompt the user of the error and then exit. (System.exit(0))    
  • Write a method called setMidtermExam that prompts the user to enter a number between 0 and 100.  If they enter a number other than this the program should prompt the user of the error and then exit. (System.exit(0))
  • Write a method called setFinalExam that prompts the user to enter a number between 0 and 100.  If they enter a number other than this the program should prompt the user of the error and then exit. (System.exit(0))
  • A method can be used to check if these values are valid
  • Write a method called calculateFinalGrade that calculates a final grade and stores that in a member variable
    • Each quiz is worth 12.5%
    • The midterm is worth 25%
    • The final is worth 50%
  • Write a method called printFinalGrade that prints out the numeric grade with also a letter grade
    • 90+  A
    • 80-89 B
    • 70-79 C
    • 60-69 D
    • <60 F
  • Run the program using the driver

 

 

Example Dialog:

 

Enter the score for quiz 1

100

Enter the score for quiz 2

100

Enter the score for midterm

80

Enter the score for the final exam

85

The final grade is

87.5

B

 

Finally:

Upload the Grader.java file to the dropbox under Lab12

 

 

 

 

Lab12 Driver:

 

/*
 * Written by ** to run the lab 12 Grader.java
 * 
 */
public class Lab12Driver {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//Creates a new instance of a grader
		Grader g = new Grader();
		//Collects the grade information
		g.setQuiz1();
		g.setQuiz2();
		g.setMidtermExam();
		g.setFinalExam();
		//Calculates the final grade
		g.calculateFinalGrade();
		//Prints the results to the user
		g.printFinalGrade();
	}

}

Subject Computer
Due By (Pacific Time) 10/13/2014 11:00 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy