-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompSciStudentDemo.java
More file actions
54 lines (43 loc) · 1.3 KB
/
CompSciStudentDemo.java
File metadata and controls
54 lines (43 loc) · 1.3 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
48
49
50
51
52
53
54
import java.util.Scanner;
/**
This program demonstrates the CompSciStudent class.
*/
public class CompSciStudentDemo
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
String choice = "";
do
{
// Create a CompSciStudent object.
CompSciStudent csStudent =
new CompSciStudent("Jennifer Haynes",
"167W98337", 2015);
// Store values for math, CS, and gen ed hours.
// Try catches should go here.
/*
* try
* {
* csStudent.setMathHours();
* }
* catch(NumberFormatException e)
* {
* System.out.println("Inncorect data type input!");
* math = true;
* }
*/
csStudent.setMathHours();
csStudent.setCSHours();
csStudent.setGenEDHours();
// Display the student's data.
System.out.println(csStudent);
// Display the number of remaining hours.
System.out.println("Hours remaining: " +
csStudent.getRemainingHours());
System.out.println("Would like to enter another? Enter end to terminate.");
choice = scan.next();
}while(!choice.toLowerCase().equals("end"));
scan.close();
}
}