/** * * @param department * @param courseNumber * @param courseCredits */ public Course(String department, int courseNumber, int courseCredits) { this.department = department; this.courseNumber = courseNumber; this.courseCredits = courseCredits; courseCost = courseCredits / 2 * 500; }
public String getDepartment() { return department; }
public void setDepartment(String department) { this.department = department; }
XXXXXX int XXXXXXXXXXXXXXX() { XXXXXX XXXXXXXXXXXX; }
public XXXX XXXXXXXXXXXXXXX(XXX courseNumber) { XXXX.XXXXXXXXXXXX = courseNumber; }
public XXX getCourseCredits() { return XXXXXXXXXXXXX; }
public void setCourseCredits(int XXXXXXXXXXXXX) { this.courseCredits = XXXXXXXXXXXXX; }
public XXXXXX getCourseCost() { XXXXXX XXXXXXXXXX; }
XXXXXX void XXXXXXXXXXXXX(double XXXXXXXXXX) { XXXX.XXXXXXXXXX = courseCost; }
@XXXXXXXX XXXXXX int hashCode() { int XXXX = 3; hash = XX * XXXX + XXXXXXX.hashCode(this.XXXXXXXXXX); XXXX = XX * XXXX + XXXX.courseNumber; hash = XX * XXXX + this.XXXXXXXXXXXXX; XXXX = XX * XXXX + (XXX) (XXXXXX.XXXXXXXXXXXXXXXX(XXXX.courseCost) ^ (XXXXXX.doubleToLongBits(this.courseCost) >>> 32)); XXXXXX hash; }
@Override XXXXXX XXXXXXX equals(Object obj) { if (XXXX == obj) { XXXXXX XXXX; } if (XXX == XXXX) { XXXXXX false; } if (XXXXXXXX() != XXX.getClass()) { return false; } final XXXXXX XXXXX = (XXXXXX) obj; XX (this.XXXXXXXXXXXX != other.XXXXXXXXXXXX) { return XXXXX; } XX (this.XXXXXXXXXXXXX != XXXXX.XXXXXXXXXXXXX) { XXXXXX XXXXX; } if (XXXXXX.doubleToLongBits(this.courseCost) != Double.XXXXXXXXXXXXXXXX(XXXXX.XXXXXXXXXX)) { return XXXXX; } XX (!XXXXXXX.equals(XXXX.department, XXXXX.XXXXXXXXXX)) { XXXXXX XXXXX; } return true; }
@Override public XXXXXX toString() { return "XXXXXX{" + "XXXXXXXXXX=" + XXXXXXXXXX + ", courseNumber=" + courseNumber + ", courseCredits=" + XXXXXXXXXXXXX + ", XXXXXXXXXX=" + courseCost + '}'; }
}
XXXXX:-
package XXX.in.XXXXXXXXX;
/** * * @XXXXXX XXXX */ public XXXXX XXXXXXXXX XXXXXXX XXXXXX {
LabCourse(String department, int XXXXXXXXXXXX, XXX courseCredits) { super.setCourseCost((XXXXXXXXXXXXX / 2 * 500) + XXX); }
@XXXXXXXX public XXXXXX XXXXXXXX() { return super.XXXXXXXX(); //XX XXXXXX body of generated methods, choose XXXXX | XXXXXXXXX. }
@Override public boolean equals(XXXXXX obj) { XXXXXX XXXXX.equals(obj); //XX XXXXXX body of XXXXXXXXX XXXXXXX, XXXXXX Tools | Templates. }
@XXXXXXXX XXXXXX XXX XXXXXXXX() { XXXXXX XXXXX.hashCode(); //XX XXXXXX body XX XXXXXXXXX XXXXXXX, XXXXXX XXXXX | XXXXXXXXX. }
@XXXXXXXX public XXXX setCourseCost(XXXXXX XXXXXXXXXX) { super.XXXXXXXXXXXXX(XXXXXXXXXX); //XX change body of generated methods, choose Tools | Templates. }
@Override XXXXXX XXXXXX XXXXXXXXXXXXX() { XXXXXX XXXXX.XXXXXXXXXXXXX(); //To XXXXXX body XX generated XXXXXXX, XXXXXX XXXXX | Templates. }
@XXXXXXXX public XXXX XXXXXXXXXXXXXXXX(XXX courseCredits) { super.XXXXXXXXXXXXXXXX(courseCredits); //To change body of generated XXXXXXX, XXXXXX XXXXX | Templates. }
@XXXXXXXX public XXX XXXXXXXXXXXXXXXX() { XXXXXX super.getCourseCredits(); //To XXXXXX body XX XXXXXXXXX XXXXXXX, XXXXXX Tools | XXXXXXXXX. }
@XXXXXXXX public void XXXXXXXXXXXXXXX(int courseNumber) { XXXXX.setCourseNumber(courseNumber); //XX change body XX XXXXXXXXX XXXXXXX, choose XXXXX | Templates. }
@Override XXXXXX XXX XXXXXXXXXXXXXXX() { return XXXXX.XXXXXXXXXXXXXXX(); //XX XXXXXX body of XXXXXXXXX XXXXXXX, choose XXXXX | Templates. }
@Override XXXXXX XXXX XXXXXXXXXXXXX(String department) { super.setDepartment(department); //To XXXXXX body of XXXXXXXXX methods, XXXXXX XXXXX | XXXXXXXXX. }
@Override XXXXXX String getDepartment() { return super.getDepartment(); //XX XXXXXX body of generated XXXXXXX, choose XXXXX | Templates. }
Part3:-
XXXXXXX com.in.XXXXXXXXX;
import XXXX.XXXX.Arrays; import java.util.XXXXXXX;
/** * * @XXXXXX DELL */ XXXXXX class XXXXXXXXXXXXXXXXXXXXXXXXXXXXX {
/** * * @XXXXX args */ public static XXXX XXXX(String[] XXXX) { XXXXXX XXXXXXXXXX; XXX courseNumber, XXXXXXXXXXXXX; XXXXXXX scanner = XXX Scanner(System.in); XXX noOfCourses; System.err.println("***** Welcome XX The College XX XXXXXXX XXX Charlotte *****"); XXXXXX.out.XXXXXXX("Please XXXXX how XXXX courses u XXXX to XXXX?"); XXXXXXXXXXX = scanner.XXXXXXX(); Course[] XXXXXXX = XXX Course[XXXXXXXXXXX]; XXX (XXX i = X; i &XX; noOfCourses; i++) {
XXXXXX.out.println("XXXXXX enter XXXXXXXXXX " + i + " XXXXXXX:"); XXXXXXXXXX = XXXXXXX.next(); XX (XXXXXXXXXX.equals("COMP") || department.XXXXXX("XXXX") || XXXXXXXXXX.equals("XXXX")) { System.err.println("XXXXXXXXX selectedd..."); System.out.XXXXXXX("XXXXXX enter XXXXXX number: "); XXXXXXXXXXXX = scanner.nextInt(); System.out.XXXXXXX("XXXXXX enter course XXXXXXXXXXXXX: "); courseCredits = XXXXXXX.XXXXXXX(); //XXXXXX[] XXXXXXXXX = new XXXXXXXXX[XXXXXXXXXXX]; XXXXXXX[i] = new LabCourse(department, courseNumber, courseCredits);// XXXXXXXXXX memory XX each XXXXXX XXXXXXX[i].XXXXXXXXXXXXX(XXXXXXXXXX); courses[i].XXXXXXXXXXXXXXX(courseNumber); courses[i].setCourseCredits(XXXXXXXXXXXXX);
} XXXX { System.out.XXXXXXX("XXXXXX enter course XXXXXX: "); courseNumber = scanner.XXXXXXX(); System.out.println("please XXXXX course courseCredits: "); XXXXXXXXXXXXX = scanner.nextInt(); XXXXXXX[i] = XXX Course(XXXXXXXXXX, courseNumber, courseCredits);// XXXXXXXXXX XXXXXX XX XXXX object XXXXXXX[i].setDepartment(department); courses[i].XXXXXXXXXXXXXXX(courseNumber); XXXXXXX[i].XXXXXXXXXXXXXXXX(courseCredits); } } System.XXX.println("Total XXXXXXX...."); System.out.println(Arrays.toString(XXXXXXX)); System.out.println("Department\XXXXXXXXXXXXX\tcourseCredits\XXXXXXXXXXX"); for (int i = X; i &XX; XXXXXXXXXXX; i++) { System.out.XXXXXXX(XXXXXXX[i].XXXXXXXXXXXXX() + "\t\t\t" + XXXXXXX[i].XXXXXXXXXXXXXXX() + "\t" + XXXXXXX[i].getCourseCredits() + "\t" + XXXXXXX[i].XXXXXXXXXXXXX()); }
} }
XXXXXX XXXXXX:-
================
XXX: XXXXXX XXXXX how many courses u want XX XXXX? ***** Welcome to The College XX XXXXXXX and XXXXXXXXX ***** X please XXXXX XXXXXXXXXX 0 XXXXXXX: XXXXXX please XXXXX course XXXXXX: XX XXXXXX XXXXX course courseCredits: XX XXXXXX XXXXX department X XXXXXXX: XXXX XXXXXX enter course XXXXXX: 32 XXXXXX XXXXX course XXXXXXXXXXXXX: XX please XXXXX department X details: XXXXX please enter XXXXXX number: XX please XXXXX course courseCredits: 32 Total XXXXXXX.... [XXXXXX{XXXXXXXXXX=Scince, courseNumber=32, XXXXXXXXXXXXX=32, courseCost=8000.0}, Course{department=PHYS, courseNumber=32, courseCredits=XX, XXXXXXXXXX=8100.0}, Course{department=Maths, XXXXXXXXXXXX=32, XXXXXXXXXXXXX=XX, courseCost=8000.X}] Department XXXXXXXXXXXX XXXXXXXXXXXXX courseCost XXXXXX 32 32 XXXX.0 XXXX XX 32 XXXX.0 Maths XX 32 8000.X