WEEK 6 ASSIGNMENT
WEEK 6 ASSIGNMENT
Circle(double radius) {
this.radius = radius;
double calculateArea() {
double calculatePerimeter() {
Triangle(double base, double height, double side1, double side2, double side3) {
this.base = base;
this.height = height;
this.side1 = side1;
this.side2 = side2;
this.side3 = side3;
double calculateArea() {
double calculatePerimeter() {
2. class Reservation {
this.reservationId = reservationId;
this.customerName = customerName;
this.date = date;
return reservationId;
this.reservationId = reservationId;
}
return customerName;
this.customerName = customerName;
return date;
this.date = date;
this.roomNumber = roomNumber;
return roomNumber;
this.roomNumber = roomNumber;
@Override
{ super.checkReservationStatus();
this.seatNumber = seatNumber;
return seatNumber;
this.seatNumber = seatNumber;
@Override
{ super.checkReservationStatus();
railwayReservation.checkReservationStatus();
3. class IDGenerator {
return nextID++;
IDGenerator.generateID());
}
4. class EvenNumbers extends Thread {
{ System.out.println("Even Numbers:");
if (i % 2 == 0)
{ System.out.print(i + "
");
} System.out.println();
{ System.out.println("Odd Numbers:");
if (i % 2 != 0)
{ System.out.print(i + "
");
} System.out.println();
}
evenThread.start();
oddThread.start();
this.matrixA = matrixA;
this.matrixB = matrixB;
this.result = result;
this.row = row;
result[row][j] = 0;
int[][] matrixA = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
int[][] matrixB = {
{9, 8, 7},
{6, 5, 4},
{3, 2, 1}
};
int rowsA = matrixA.length;
threads[i].start();
try {
threads[i].join();
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println("Resultant Matrix:");
} System.out.println();
}
}