Question: Create a class called PetrolPurchase to represent information about the petrol you purchase. The class should include five pieces of information in the form of
Create a class called PetrolPurchase to represent information about the petrol you purchase. The class should include five pieces of information in the form of instance variables the station location, the quantity of purchase in litres, the type of petrol, the price per litre and the percentage of discount.
Your class should have a constructor that initiates the five instance variables, accessor methods, mutator methods, payment method, a strmethod that returns the information of instance variable and a reprmethod to indicate how an object can be created.
The following shows the interactions:
Enter the station: Bukit Timah
Enter quantities in litres:
Enter type of petrol: Super
Enter price of petrol:
Enter discount:
The system displays the following summary purchased:
Summary of purchase
Station: Bukit Timah
Quantity:
Petrol type: Super
Unit price:
Discount:
Total cost: $
Total discount : $
Final payment: $
The customer decides to add in some for more litres of petrol:
Additional quantity:
Final Summary of purchase
Station: Bukit Timah
Quantity:
Petrol type: Super
Unit price:
Discount:
Total cost: $
Total discount : $
Final payment: $
Finally the call of repr object was constructed:
function to describe how the final
The object was constructed according to:
PetrolPurchase Bukit Timah", "Super
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
