Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I cannot figure out how to get this format out of my code. Here is what I have so far. It is BlueJ (JAVA) language.

image text in transcribed
I cannot figure out how to get this format out of my code. Here is what I have so far. It is BlueJ (JAVA) language. I need it to be exactly like the picture. Please and thanks.

import java.io.File;

import java.io.IOException;

import java.nio.charset.StandardCharsets;

import java.nio.file.Files;

import java.util.List;

public class Lab11 {

public static void main(String[] args)

{

System.out.println("************************************************");

System.out.println("** **");

System.out.println("** Lab 11 Spring 2018 **");

System.out.println("** **");

System.out.println("************************************************");

try

{

File file = new File("scores11.csv");

List lines = Files.readAllLines(file.toPath(),

StandardCharsets.UTF_8);

for (String line : lines) {

String[] scores = line.split(",");

double aveScore = aveScores(scores);

String grade = calcLetterGrade(aveScore);

printScores(scores, aveScore, grade);

}

}

catch(IOException ioe) {System.out.println(ioe);}

}

private static void printScores(String[] scores, double aveScore, String grade) {

System.out.println("Student # Scores Ave Grade");

System.out.println("--------------------------------------------------");

for (int i = 0; i

System.out.print(scores[i] + " ");

}

System.out.println(" Average is :" + aveScore);

System.out.println("Grade is : " + grade);

System.out.println("");

}

private static double aveScores(String[] scores) {

double sum = 0;

for (int i = 0; i

sum += Integer.parseInt(scores[i]);

}

return sum / scores.length;

}

private static String calcLetterGrade(double score) {

int aveScore = (int)score;

if (aveScore >= 90 && aveScore

return "A";

} else if (aveScore >= 80 && aveScore

return "B";

} else if (aveScore >= 70 && aveScore

return "C";

} else if (aveScore >= 60 && aveScore

return "D";

} else if (aveScore

return "F";

} else {

return "";

}

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago