I'm doing this for a class assignment. Please keep in mind that I'm learning and new at this. I've compiled my code and it runs fine. It's doing what i want.
Part of the class assignment is that when it prints that unnecessary decimals don't show up when not needed e.g. 85.00. Here is my code.
public class Assignment1 {
public static void main (String cyclops[]) {
Scanner input = new Scanner (System.in);
System.out.print("Welcome to the CST8215 Final Mark Calculator \n");
System.out.print("Entered Lab mark out of 10: ");
float lab = input.nextFloat();
System.out.print("Entered Quiz/Test mark out of 10: ");
float quiz_test = input.nextFloat();
System.out.print("Entered assignment mark out of 20 ");
float assignment = input.nextFloat();
System.out.print("Entered midterm mark out of 20: ");
float midterm = input.nextFloat();
System.out.print("Entered final exam mark out of 40 ");
float final_exam = input.nextFloat();
float theoryGrade = (quiz_test + midterm + final_exam) *100/70;
float practicalGrade = (assignment + lab) *100/30;
float finalGrade = (lab + quiz_test + assignment + midterm + final_exam);
System.out.format("theoryGrade: %.2f%%%n",theoryGrade);
System.out.format("practicalGrade: %.2f%%%n",practicalGrade);
System.out.format("finalGrade: %.2f%%%n",finalGrade);
} // end of main
}// end of class