Lab 3 OOP
Lab 3 OOP
Lab 3 OOP
// Default constructor
public Rectangle() {
length = 5;
width = 2;
}
// Parameterized constructor
public Rectangle(int l, int w) {
length = l;
width = w;
}
ACTIVITY 2
public class Time {
int hours;
int minutes;
int seconds;
public Time() {
hours = 0;
minutes = 0;
seconds = 0;
}
t1.setHours(0);
t1.setMinutes(0);
t1.setSeconds(0);
t1.Display();
ACTIVITY 3
public class Point {
private int x;
private int y;
public Point() {
x = 0;
y = 0;
}
ACTIVITY 4
public class Student {
private String name;
private int[] result_array = new int[5];
ACTIVITY 5
public class HotDogStand {
private int standID;
private int hotDogsSold;
stand1.justSold();
stand2.justSold();
stand2.justSold();
stand3.justSold();
stand3.justSold();
stand3.justSold();