CSE111-Lab-Assignment-7-Fall24
CSE111-Lab-Assignment-7-Fall24
Number of Tasks: 11
[Submit all the Coding Tasks (Task 1 to 8) in the Google Form shared on buX
before the next lab. Submit the Tracing Tasks (Task 9 to 11) handwritten to your
Lab Instructors at the beginning of the lab]
[You are not allowed to change the driver codes of any of the tasks]
Task 1
Given the following classes, write the code for the BBAStudent class so that
the following output is printed when we run the TestStudent class.
//Tester Class
public class TestStudent{
public static void main(String [] args){
BBAStudent b1 = new BBAStudent();
BBAStudent b2 = new BBAStudent("Humty Dumty");
BBAStudent b3 = new BBAStudent("Little Bo
Peep");
b1.details();
System.out.println("1---------------");
b2.details();
System.out.println("2---------------");
b3.details();
}
}
Task 2
Design the CheckingAccount class derived from the Account class with
appropriate attributes and properties so that the driver code can generate
the output given below.
//Tester Class
public class TestAccount{
public static void main(String [] args){
System.out.println("Total Checking Accounts:
"+CheckingAccount.count);
CheckingAccount c1 = new CheckingAccount();
System.out.println("Account Balance: " + c1.showBalance());
CheckingAccount c2 = new CheckingAccount(100.0);
System.out.println("Account Balance: " + c2.showBalance());
CheckingAccount c3 = new CheckingAccount(200.0);
System.out.println("Account Balance: " + c3.showBalance());
System.out.println("Total Checking Accounts:
"+CheckingAccount.count);
}
}
Task 3
Design the Dog and Cat class derived from the Animal class with appropriate
attributes and properties so that the driver code can generate the output given
below.
//Tester Class
public class Vehicle2010User{
public static void main(String[] args){
Vehicle2010 car1 = new Vehicle2010();
System.out.println(car1);
car1.moveLowerLeft();
System.out.println(car1);
}
public class ComplexNumberTester {
public static void main(String[] args) {
ComplexNumber cn1 = new ComplexNumber();
System.out.println(cn1);
System.out.println("----------------");
ComplexNumber cn2 = new ComplexNumber(5.0, 7.0);
System.out.println(cn2);
}
}
Task 6
Design the Manager and Developer class derived from the Employee class with
appropriate attributes and properties so that the driver code can generate
the output given below. [Hint:
Manager:
1. Adds a bonus to the base salary if the manager works more than 40 hours.
2. If the manager works more than 100 hours, the full amount is approved; if they
work more than 80 hours, half the amount is approved. Otherwise, the increment
is denied.
Developer:
1. Adds $700 to the base salary if the developer works with Java programming
language.]
Driver Code and Parent Class Output
Task 7
Design the CinemexTicket class derived from the MovieTicket Class so that the given
output is produced:
❖ The seatTypes and seatPrices arrays contain the type of the seat and its
corresponding price
❖ Night show charge (15% of ticket price) will be applicable if the time is
between 6:00 PM - 11:00 PM
❖ Unique id for a ticket is generated by:
MovieName-FirstLetterOfSeatType-TicketCount
❖ You may need to use .split() and Integer.parseInt() built-in methods
Task 1
Design the class Dog so that the desired outputs are generated properly.
Driver Code and Parent Class Expected Output
Task 2
Design the ScienceExam class with the necessary property to produce the
output from the given driver code.