-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMsStudent.java
More file actions
37 lines (26 loc) · 1.03 KB
/
Copy pathMsStudent.java
File metadata and controls
37 lines (26 loc) · 1.03 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
import java.util.ArrayList;
public class MsStudent extends GraduateStudent {
ArrayList<Lecture> classes;
public MsStudent(String name, String id, ArrayList<Lecture> classes) {
super(name, id);
this.classes = classes;
}
public void printInvoice() {
System.out.println("VALENCE COLLEGE\nORLANDO FL 10101\n---------------------\n");
System.out.println("Fee Invoice Prepared for Student: \n" + getId() + "-" + getName() + "\n");
double rate = 300;
double total = 0;
System.out.printf("1 Credit Hour = $%.2f\n", rate);
System.out.println("\nCRN\tCRN_PREFIX\tCR_HOURS");
for(int i = 0; i < classes.size(); i++) {
String crn = classes.get(i).getCrn();
String prefix = classes.get(i).getPrefix();
int crHrs = classes.get(i).getCreditHours();
System.out.printf("%s\t%s\t\t%d\t$%.2f\n", crn, prefix, crHrs, crHrs*rate);
total += crHrs*rate;
}
System.out.println("\nHealth & id fees\t\t$35.00");
total += 35;
System.out.printf("----------------------------------------\n\tTotal Payments\t\t$%.2f\n", total);
}
}