Grading Program

Grading Program

Page 1 of 1

0 Replies - 875 Views - Last Post: 16 September 2008 - 08:34 PM Rate Topic: -----

#1 LMullin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 16-September 08

Grading Program

Post icon  Posted 16 September 2008 - 08:34 PM

Hello. I could really use some help if anyone has the time.

I am having a few problems. I cannot seem to figure out how to use the math class properly and keep getting errors. I need to round the number given, then change it to an int, then output the number in only 3 decimal places. I do not know how to input to be in the output. And is there a code to use that will allow upper and lower case letters without typing each letter grade upper and lower case? I'm sure there is one and remember reading it, but cannot find it in my 'useful' book.

Thank you for any help you may provide!

Lisa

import static java.lang.Math.*;

import java.util.*;

public class MullinLisaProg4_5
{
	public static void main (String[] args)
	{
	//
	System.out.println("Welcome to Lisa’s Grading Program");

	Scanner stdIn = new Scanner (System.in);
	char grade;
	char letterGrade;
	double numericGrade;

	System.out.print("Will you be entering in numbers or letters? (type n for numbers and l for letters");
	grade = stdIn.nextLine().charAT(0);


while (grade == 'n')
		{
		System.out.println("Enter a number with five numbers after decimal: for example 75.22645");
		numbericGrade += stdln.nextLine ();
		double floor(double numericGrade);
		finalNumericGrade = (int) numericGrade;

			if (numericGrade >=90)
			finalLetterGrade ="Great Job you earned an A!";
			else if ((numericGrade >=80) & (finalNumericGrade <90))
			finalLetterGrade ="You earned a B, not too shabby.";
			else if ((numericGrade >=70) & (finalNumericGrade <80))
			finalLetterGrade ="You have earned a C";
			else if ((numericGrade >=60) & (finalNumericGrade <70))
			finalLetterGrade ="D";
			else if ((numericGrade >=0) & (finalNumericGrade <60))
			finalLetterGrade ="F";}

			while (grade == 'l')
					{
					System.out.println("Please enter a letter grade.");
					letterGrade += stdln.nextLine ();}

					switch(letterGrade)
						{
						case A:
								System.out.println("90-100 = A");
								break;
						case B:
								System.out.println("80-89 = B");
								break;
						case C:
								System.out.println("70-79 = C");
								break;
						case D:
								System.out.println("60-69 = D");
								break;
						case F:
					System.out.println("0-59 = F");}

		System.out.println("Your letter grade is as follows:\n" + finalLetterGrade);
	  }
  }


Is This A Good Question/Topic? 0
  • +

Page 1 of 1