I have tried numerous ways of trying to align the numbers, but so far no luck. I am sure its something simple, if I could have a little help that would be appreciated.
Here is the output
and code below
Student Quiz 1 Quiz 2 MidTerm Final Final% Grade
1
2
3
4
8 7 89 94 88 B
9 6 77 90 83 B
10 10 65 88 85 B
7 5 80 81 75 C
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) { Scanner grades = null; try { grades = new Scanner(new File("prog349f.dat")); } catch(Exception e) { System.err.println("Error: " + e.getMessage()); } System.out.println("Student Quiz 1 Quiz 2 MidTerm Final Final% Grade"); System.out.println(" 1 "); System.out.println(" 2 "); System.out.println(" 3 "); System.out.println(" 4 "); while(grades.hasNextInt()) { int quiz1 = grades.nextInt(); int quiz2 = grades.nextInt(); int midterm = grades.nextInt(); int finals = grades.nextInt(); Grader gradeThis = new Grader(quiz1, quiz2, midterm, finals); double Grade1 = (gradeThis.getQuizAvg()); double Grade2 = (gradeThis.getMidAvg()); double Grade3 = (gradeThis.getFinalAvg()); int finalPer = (int)(Grade1 + Grade2 + Grade3); System.out.format("%12d", quiz1); System.out.format("%8d", quiz2); System.out.format("%8d", midterm); System.out.format("%8d", finals); System.out.format("%8d", finalPer); if(finalPer < 60) { System.out.println(" F"); } if(finalPer > 60 && finalPer < 70) { System.out.println(" D"); } if(finalPer > 70 && finalPer < 80) { System.out.println(" C"); } if(finalPer > 80 && finalPer < 90) { System.out.println(" B"); } if(finalPer >= 90) { System.out.println(" A"); } } } } public class Grader { public Grader(int q1, int q2, int mid, int fin) { firstquiz = q1; secquiz = q2; midTerm = mid; theFinal = fin; } private double findQuizAvg() { double quizAvg = (((firstquiz * 10 + secquiz * 10 ) /2) * .25); return(quizAvg); } private double findMidAvg() { double midAvg = (midTerm * .25); return(midAvg); } private double findFinalAvg() { double finalAvg = (theFinal * .50); return(finalAvg); } public double getQuizAvg() { double gradeOne = findQuizAvg(); return(gradeOne); } public double getMidAvg() { double gradeTwo = findMidAvg(); return(gradeTwo); } public double getFinalAvg() { double gradeThree = findFinalAvg(); return(gradeThree); } public int firstquiz; public int secquiz; public int midTerm; public int theFinal; }