-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssign1.java
More file actions
47 lines (33 loc) · 1.72 KB
/
Assign1.java
File metadata and controls
47 lines (33 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.Scanner;
import java.text.DecimalFormat;
/* Name: Adam Mohr
* Section: 301
* Lab Teacher: Jason Mombourquette
* Purpose of Program: Calculate your Computer Essentials final grade based on input marks.
* Assignment Number #1
* Date: Friday February 16th
*/
public class Assign1 {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
double labMark, hybridMark, testMark, finalMark, theoryGrade, practicalGrade, finalGrade; // Declare variables.
DecimalFormat percentRound = new DecimalFormat("##.##"); // Set decimal format for grade percentages.
System.out.println("Welcome to the CST8101 Final Mark Calculator\n");
System.out.print("Enter your Lab Assignments mark out of 25: "); // Receive input for marks.
labMark = input.nextDouble();
System.out.print("Enter your Hybrid Activities / Quizzes mark out of 20: ");
hybridMark = input.nextDouble();
System.out.print("Enter your Test mark out of 25: ");
testMark = input.nextDouble();
System.out.print("Enter your Final Assessment (Exam) mark out of 30: ");
finalMark = input.nextDouble();
System.out.println("");
theoryGrade = (testMark + finalMark) / 55 * 100; // Calculate grades.
practicalGrade = (hybridMark + labMark) / 45 * 100;
finalGrade = (labMark + hybridMark + testMark + finalMark) / 100 * 100;
System.out.println("Theory grade: " + percentRound.format(theoryGrade) +"%"); // Output grade percentages using the decimal format.
System.out.println("Practical grade: " + percentRound.format(practicalGrade) + "%");
System.out.println("Final grade: " + percentRound.format(finalGrade) + "%");
input.close();
}
}