Create a class called PetrolPurchase to represent information about the petrol you purchase. The class should...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 and a copy constructor to duplicate the objects. Provide a set and a get method for each instance variables (even my UML diagram didn't show all of them ...). In addition, include a method called get Payment that gets the net purchase amount computed in the computePayment method. Write a java program with two classes (see UML diagram) defined in one class and PetrolPurchase is another independent class. The following shows the interactions: Enter the station: Bukit Timah Enter quantity in liter: 25.5 Enter type of petrol: Super 99 Enter price of petrol: 3.55 Enter discount: 15 The system displays the following summary purchased: Summary of your purchase Station: Bukit Timah Total liter: 25.50 Petrol type: Super 99 Price per liter: 3.55 Actual cost: 98.52 Discount (15%): 13.58 Amount to pay: 76.95 The customer decides to add in some for more litres of petrol: Enter addtional quantity of petrol: 15.5 Your new purchased price Station: Bukit Timah Total liter: 41.00 Petrol type: Super 99 Price per liter: 3.55 Actual cost: 145.55 Discount (15%): 21.83 Amount to pay: 123.72 The company usually give a duplicate copy to customer. Invoke the copy constructor to have this duplicate copy: Duplicate the same object Station: Bukit Timah Total liter: 41.88 Petrol type: Super 99 Price per liter: 3.55 Actual cost: 145.55 Discount (15%): 21.83 Amount to pay: 123.72 The following shows the UML diagram of the two classes: static void mandlitinalarasi Lab 3 - - -String station -double quantity -Sting type -double price -int discount PetrolPurchase PatrolPurchase(Strings, double a String t, double p, int d) PetrolPurchase(PatrolPurchase pp) o-String getStation String getType o-double getQuantity double getPrice +int getDiscount Ovoid setStation(String station) Usual programming practice must be respected: file header declarations - indentations and alignment of statements void setType(String type) void setPrice(double price) void setQuantity(double quantity) Ovoid setDiscaountont discount -void setinfo (Strings, double q, Stringt double p, int d) -double computePayment double getPayment void printinfo avoid long statement comment statements well partition your screen to have clear interactions and displays. use of other constructors to construct objects etc For printing, you can ONLY use printf method in this lab, i.e. print and println methods are not allowed in this lab. 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 and a copy constructor to duplicate the objects. Provide a set and a get method for each instance variables (even my UML diagram didn't show all of them ...). In addition, include a method called get Payment that gets the net purchase amount computed in the computePayment method. Write a java program with two classes (see UML diagram) defined in one class and PetrolPurchase is another independent class. The following shows the interactions: Enter the station: Bukit Timah Enter quantity in liter: 25.5 Enter type of petrol: Super 99 Enter price of petrol: 3.55 Enter discount: 15 The system displays the following summary purchased: Summary of your purchase Station: Bukit Timah Total liter: 25.50 Petrol type: Super 99 Price per liter: 3.55 Actual cost: 98.52 Discount (15%): 13.58 Amount to pay: 76.95 The customer decides to add in some for more litres of petrol: Enter addtional quantity of petrol: 15.5 Your new purchased price Station: Bukit Timah Total liter: 41.00 Petrol type: Super 99 Price per liter: 3.55 Actual cost: 145.55 Discount (15%): 21.83 Amount to pay: 123.72 The company usually give a duplicate copy to customer. Invoke the copy constructor to have this duplicate copy: Duplicate the same object Station: Bukit Timah Total liter: 41.88 Petrol type: Super 99 Price per liter: 3.55 Actual cost: 145.55 Discount (15%): 21.83 Amount to pay: 123.72 The following shows the UML diagram of the two classes: static void mandlitinalarasi Lab 3 - - -String station -double quantity -Sting type -double price -int discount PetrolPurchase PatrolPurchase(Strings, double a String t, double p, int d) PetrolPurchase(PatrolPurchase pp) o-String getStation String getType o-double getQuantity double getPrice +int getDiscount Ovoid setStation(String station) Usual programming practice must be respected: file header declarations - indentations and alignment of statements void setType(String type) void setPrice(double price) void setQuantity(double quantity) Ovoid setDiscaountont discount -void setinfo (Strings, double q, Stringt double p, int d) -double computePayment double getPayment void printinfo avoid long statement comment statements well partition your screen to have clear interactions and displays. use of other constructors to construct objects etc For printing, you can ONLY use printf method in this lab, i.e. print and println methods are not allowed in this lab.
Expert Answer:
Related Book For
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Demand function for a firm is given as P-100e, if the firm's average cost (AC) is AC 5+50, determine the firm's maximum profit. (5marks).
-
With the CARES Act costing over $2 trillion and the federal government facing a significant decline in tax revenue, explain the effectiveness of fiscal policy using the three claims outlined in the...
-
A steam pipe 200 mm in diameter passes through a large basement room. The temperature of the pipe wall is 500?C, while that of the ambient air in the room is 20?C. Determine the heat transfer rate by...
-
Complete the following statements and locate the missing word(s) in the find-a-word puzzle. The answers are in straight lines but can be in any direction, including diagonal and reverse. a This Act...
-
The John Gore Organization owns and operates the Charles Playhouse, a theater in Boston, Massachusetts. Evelyn Castillo has diabetes, a disability under the Americans with Disabilities Act (ADA)....
-
The Hillside Inn is a restaurant in Flagstaff, Arizona. It specializes in southwestern style meals in a moderate price range. Phil Weld, the manager of Hillside, has determined that during the last 2...
-
Megan and Nancy each want save $250 000 for their retirement 40 years. a) Nancy begins her regular deposits immediately. How much must she deposit end 12% per year compounded annually achieve her...
-
Angela Petrillo recendy opened her own law office, which she operates as a corporation. The name of the new entity is Angela Petrillo, Attorney. Petrillo experienced the following events during the...
-
Covid-19 brings a big shock to the world in the beginning of 2020. The shock makes a lot of cities be lockdown couple months and leads to serious economic problems. Based on this background, most of...
-
1. Complete the table below by estimating the number of resignations at each job level based on the percentage turn over, and calculating the positions that need to be filled for the next quarter...
-
find NPV, IRR, and PI Revenue: 18 million Common stock-$7-9 per share Product life cycle- 3-5 years Building lease- $575,000 Labor cost-7 million Labor Efficiency- 20% Rate of Return- 16% Upfront...
-
Patrick, Inc. has a 10%, $20,000 face, note receivable. When there is one year left on the note, Patrick discounts the note with First National Bank, which charges Patrick a 15% discount rate....
-
Labor estimating is normally recorded in both hours and dollars. An element in the work breakdown structure was estimated to require one month for accomplishment. The element was estimated at 1,000...
-
1. Title of the assigned disability and brief description from the current DSM. 2. How the disability may impact a person's education and 3. Social development in elementary through high school. 4....
-
P/E capital spend/share long term debt (000s) shares (000s) earnings per share working capital (000s) depreciation (000s) weighted aver cost of capital PV factor for FCFF tax rate 2020 (actual) 16.00...
-
Proposals have been made to ?sail? spacecraft to the outer solar system using the pressure of sunlight, or even to propel interstellar spacecraft with high-powered, Earth-based lasers. Sailing...
-
Write six different queries for the 3NF relation in Problem 5 in Chapter 13.
-
Draw an entity-relationship diagram for the following situation: A commercial bakery makes many different products. These products include breads, desserts, specialty cakes, and many other baked...
-
Ricardo has asked you to computerize the billing process for Citron so that customers can get their cars quickly and still be billed correctly. Draw a decision table that represents the conditions,...
-
Instead of the results in problem 8.4, consider the results reported below: Assume the results reported in problem 8.4 hold, except that a difference existed among budgeted (static) enrollment and...
-
The following information is for an order produced by Tyler Co. Compute cycle time and cycle efficiency. Part 2 Use the following information to compute days' sales in work in process inventory....
-
A lean manufacturer incurs \(\$ 45\) per unit in raw materials page D-9 costs and applies \(\$ 75\) per unit in conversion costs to produce office chairs. Each chair is sold for \(\$ 170\). In the...
Study smarter with the SolutionInn App