NetBeans Style With Screenshots
NetBeans Style With Screenshots
Paracha 24K-6040
Author: Muhammad Ahmed Rashid Paracha
Student ID: 24K-6040
TASK 1 Output
Box [Width = 5, Height = 10]
NetBeans Screenshot:
// Copy Constructor
public Student(Student other) {
this.studentID = other.studentID;
this.name = other.name;
this.cgpa = other.cgpa;
this.department = other.department;
}
NetBeans Screenshot:
@Override
protected void finalize() throws Throwable {
if (capacity != 0) {
System.out.println("Warning: Tank is not empty on cleanup.");
}
super.finalize();
}
}
TASK 4 Output
Tank filled. Current capacity: 30
Tank emptied.
NetBeans Screenshot:
Main Method (NetBeans Style)
// Task 2 Demonstration
Student student1 = new Student(24, "Ahmed", 3.8f, "CS");
student1.display();
Student student2 = new Student(42);
student2.display();
Student student3 = new Student(3.5f);
student3.display();
Student studentCopy = new Student(student1);
studentCopy.display();
// Task 4 Demonstration
Tank tank = new Tank(10);
tank.fill(20);
tank.empty();
}
}
NetBeans Screenshot: