Question: double totalscore = 0,avg; int score,count = 0; String grade; while(inF.hasNextInt()) { score= inF.nextInt(); if(vaildScore(score)) { grade = letterGrade(score); System.out.printf(%d %s %n,score,grade); totalscore += score;

 double totalscore = 0,avg; int score,count = 0; String grade; while(inF.hasNextInt())

{ score= inF.nextInt(); if(vaildScore(score)) { grade = letterGrade(score); System.out.printf("%d %s %n",score,grade); totalscore

+= score; count++; } else { System.out.printf("%d Invaild score%n",score); } } inF.close();

double totalscore = 0,avg; int score,count = 0; String grade; while(inF.hasNextInt()) {

score= inF.nextInt(); if(vaildScore(score)) { grade = letterGrade(score); System.out.printf("%d %s %n",score,grade); totalscore += score; count++; }

else { System.out.printf("%d Invaild score%n",score); } } inF.close(); avg= totalscore/ count; System.out.printf("Average: %.2f, Letter Grade: %s %n",avg , letterGrade(avg)); System.out.printf("%nEnd of Program%n");

}

static boolean vaildScore(double score) { if (score 100) return false;

else return true; }

static String letterGrade(double score) { if(score >= 90) return "A"; else if(score >= 80) return "B"; else if(score >= 70) return "C"; else if(score >= 60) return "D"; else return "F"; } }

Note: there are 58 Sample Output and - in the header. **Lab 10 Fall 2018

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!