CSE111 Lab Assignment 8 - Summer'24
CSE111 Lab Assignment 8 - Summer'24
Number of Tasks: 11
[You are not allowed to change the driver codes of any of the tasks]
Task 1
Design the Passenger class in such a way that the following code provides the
expected output.
● Passenger class has two static variables no_of_passenger and total_fare.
● Each passenger has to pay 20 TK/Distance and extra 10 TK/BaggageWeight.
Given Code Expected Output
System.out.println("==========4==========");
System.out.println("Total Books Sold: " + Book.total_books_sold);
System.out.println("Total Revenue: "+Book.total_revenue + " TK");
}
}
Task 3
Design a Student class in such a way that the following code provides the expected
output.
For this task, you need to design the Cargo class with appropriate static and
non-static variables and methods to produce this given output for the given tester
code.
Note: .load() method marks an object as selected for transport, and .unload() method
unmarked it. At a time, the transport capacity is 10.0 Tonnes. Each Cargo object is
initialized with 2 attributes from the constructor - the contents and the weight.
Carefully observe the outputs to identify the other attributes and design the class.