Edwin 6-4

  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Edwin 6-4 as PDF for free.

More details

  • Words: 215
  • Pages: 2
package Project64; import java.util.*; public class LetterGrade { public static String getLetterGrade(double d){ double grade=d; String lettergrade="Grade"; if (grade >=96) lettergrade = "A+"; else if (grade >=92) lettergrade = "A"; else if (grade >=90) lettergrade = "A-"; else if (grade >= 86) lettergrade = "B+"; else if (grade>=82) lettergrade = "B"; else if (grade>=80) lettergrade = "B-"; else if (grade>=76) lettergrade = "C+"; else if (grade>=72) lettergrade = "C"; else if (grade>=70) lettergrade = "C-"; else if (grade>=66) lettergrade = "D+"; else if (grade>=62) lettergrade = "D"; else if (grade>=60) lettergrade = "D-"; else if (grade>=0) lettergrade = "F"; return lettergrade; } public static void main(String[] args) { //LetterGrade machine = new LetterGrade(); Scanner reader = new Scanner(System.in); boolean boo = true; double average=0, total=0; double min=100; double max=0; double count=0; while (boo==true){ System.out.print("Please enter a score: "); double input = reader.nextDouble(); if (input>=0){ total = total +input; count++; if (input > max) max = input; if (input < min) min = input; }else {

boo=false; } average = total / count; } String averagelet = LetterGrade.getLetterGrade(average); String maxlet=LetterGrade.getLetterGrade(max); String minlet= LetterGrade.getLetterGrade(min); System.out.printf("The average is: %.1f" ,average); System.out.println(" " + averagelet); System.out.printf("The top score is: %.1f" , max); System.out.println(" " + maxlet); System.out.printf("The lowest score is: %.1f" , min); System.out.println(" " + minlet); } }

Related Documents

Edwin
August 2019 52
Edwin
November 2019 51
64
December 2019 30
64
April 2020 23
64
November 2019 41
64
May 2020 23