4 of 5 Paper No: 1
The Main class is provided for you in binary form. You only test your program by running the binary file.
Enter model: Tatra 810 4x4
Enter fuel Type: GASOLINE
There are several test cases for you, as follows:
Enter model: Tatra 810 4x4
Enter model: Tatra 810 4x4
Enter fuel Type: GASOLINE
Enter fuel Type: GASOLINE
Enter fuel Efficiency:8.112
Enter fuel Efficiency:8.112
Enter cargo Capacity:4.5
1. Test toString
Enter cargo Capacity:4.5
Enter fuel Efficiency:8.112
Enter cargo Capacity:4.5125
1. Test toString
2. Test calculateFuel Efficiency
3. Test calculate Distance Traveled
Enter your choice(1|2|3):1
OUTPUT:Tatra 810 4x4, GASOLINE, 8.11, 4.51
2. Test calculateFuel Efficiency
3.Test
calculate Distance Traveled
Enter your choice(1|2|3):2
OUTPUT:
1. Test toString
2. Test calculateFuel Efficiency
3. Test calculateDistance Traveled
Enter your choice(1|2|3):3
OUTPUT:65.51
Question 3:
8.08
(2 marks)
Write a class named Journal with the following information:
Journal
-id: int
-publisher: String
-price: double
+ Journal ()
+ journal(id: int, publisher:String,
price: double)
+Getters & Setters
+toString(): String
Where:
Journal() - default constructor
String,Journal (id: int, publisher:price:double) parameterized constructor
that set values to the id, publisher and price Getters & Setters write the setters and getters of all the fields
• toString(): String-return a string format that contains all the information of the Journal:id, publisher, price. The price is formatted
+ 100%
Close