long
public class Test1 { public static void main(String[] args) { UCLAClass c = new UCLAClass("PIC20A", 4, "Introduction of Java"); System.out.println(c.getClassID()); System.out.println(c.getClassTitle()); System.out.println(c.getUnits()); System.out.println(); c.showInfo(); } } |
PIC20A Introduction of Java 4 Class ID: PIC20A Class Title: Introduction of Java Units: 4 |
public class Test2 { public static void main(String[] args) { UCLAStudent charles = new UCLAStudent(502111234, "Charles Li"); UCLAClass pic20a = new UCLAClass("PIC20A", 4, "Introduction of Java"); UCLAClass pic10a = new UCLAClass("PIC10A", 5, "Introduction of C++"); UCLAClass math120 = new UCLAClass("MATH120", 3, "Number Theory"); UCLAClass math111 = new UCLAClass("MATH111", 4, "Algebra"); charles.add(pic20a, 'A'); charles.add(pic10a, 'B'); charles.add(math120, 'D'); charles.add(math111,'F'); charles.showStudentInfo(); System.out.println(); charles.showClasses(); System.out.println(); System.out.println("GPA is " + charles.gpa()); } } |
Student ID: 502111234 Name: Charles Li PIC20A A PIC10A B MATH120 D MATH111 F GPA is 2.125 |
/** Name: Charles Li * Student ID : 000 000 000 * PIC ID: ccli * E-mail: ccli@math.ucla.edu * Discussion: 1A, John Baber * Assignment: hw3 * * I, Charles Li, pledge that this is my own independent work, which * conforms to the guidelines of academic honesty as described in the * course syllabus. * */