Grades

  • Uploaded by: david johnson
  • 0
  • 0
  • November 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 Grades as PDF for free.

More details

  • Words: 214
  • Pages: 2
Grades /* * Main.java * * Created on September 25, 2007, 4:49 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package grades; import java.text.*; /** * * @author instructor */ public class Main { /** Creates a new instance of Main */ public Main() { } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here double currentScore = 0; double totalScore = 0; int count = 0; String isContinue = "yes"; while (isContinue.equalsIgnoreCase("yes")) { System.out.println("Please enter a new score:"); currentScore = MyInput.readDouble(); totalScore = currentScore + totalScore; count = count + 1; if(currentScore >= 90) { System.out.println(currentScore + " is an A"); } else if(currentScore >= 80) {

System.out.println(currentScore + " is a B"); } else if(currentScore >= 70) { System.out.println(currentScore + " is a C"); } else if(currentScore >= 60) { System.out.println(currentScore + " is a D"); } else { System.out.println(currentScore + " is an F"); } //if else if statement ends here System.out.println("Continue? (yes/no)"); isContinue = MyInput.readString(); }//while loop ends double average = totalScore / count; NumberFormat averageFormat = NumberFormat.getNumberInstance(); averageFormat.setMaximumFractionDigits(2); averageFormat.setMinimumFractionDigits(2); System.out.println("The average score is: " + averageFormat.format(average)); } // main() method ends }//Main class ends

Related Documents

Grades
October 2019 36
Grades
May 2020 25
Grades
April 2020 22
Grades
November 2019 36
Grades
November 2019 36
Grades
December 2019 28

More Documents from "ibti"

Syll_fall_2008
November 2019 17
Acct 101 Syllabus
November 2019 27
Classex For Loop
November 2019 24
Jake S Client And Pet Data
November 2019 20
Mortgage Table
November 2019 18