Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(JAVA LANGUAGE PLEASE) Taska 3 Create accoled hvoice star shantwortet foran e sold at the store. Anvende for formance apart number ftpe Stral 2. part

image text in transcribed
image text in transcribed
(JAVA LANGUAGE PLEASE)
image text in transcribed
Taska 3 Create accoled hvoice star shantwortet foran e sold at the store. Anvende for formance apart number ftpe Stral 2. part description (ope Streal 31 a quantity of these besprchase opet #price per Mobile . Your class should have this operator that is the first res. Provide a set and get method for each instance . In addition, prevalenthodnoned settimana ha calcites the amount, multiplies the quantity by the propertherm the amount double value the quantity net positive, it should be set to the price per te mot positive. It should be set to .. Write test app wakthuse's capabilities The input volues for the quantity and the price per me validated before they can be used to see the corresponding instance with direct the constructor and in the appropriate set methods + The method header for mount bull epile double geticent Your output should appear as follows: Solution Original invoice information Part number: 1234 Description: Hammer Quantity: 2 Price: 1495 Invoice amount: 29.90 Updated invoice information Part number: 001234 Description: Yellow Hammer Quantity: 3 Price: 19.49 Invoice amount: 58.47 Original invoice information Part number: 5678 Description: Paint Brush Quantity: 0 Price: 0.00 Invoice amount:0.00 Updated invoice information Part number: 5678 Description: Paint Brush Quantity: 3 Price: 9.49 Invoice amount: 28.47 Task# 4 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's location (type String), The type of petrol (type String), The quantity (type int) of the purchase in liters, The price per liter (double), The percentage discount (double). Provide a set and a get method for each instance variable. In addition, provide a method named getPurchase Amount that calculates the net purchase amount (i.e., multiplies the quantity by the price per liter) minus the discount, then returns the net amount you had to pay as a double value. Write an application class named Petrol that demonstrates the capabilities of class PetrolPurchase. TOSTI Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four pieces of information as instance variables- 1- a part number (type String), 2. a part description (type String). 3- a quantity of the item being purchased (type int) and + a price per item (double). Your class should have this operator that initializes the four instance variables. Provide a set and a get method for each instance variable. In addition, provide a method named getInvoiceAmount that calculates the invoice amount (.e, multiplies the quantity by the price per item), then returns the amount as a double value. If the quantity is not positive, it should be set to 0. If the price per item Is not positive, it should be set to 0.0. Write a test application named Invoice Test that demonstrates class Invoice's capabilities. Hints: The input values for the quantity and the price per item must be validated before they can be used to set the corresponding Instance variables. This should be done both in the constructor and in the appropriate set methods The method header for getInvoiceAmount should be public double getinvolceAmount Your output should appear as follows: Solution Original invoice information Part number: 1234 Description: Hammer Quantity: 2 Price: 14.95 Invoice amount: 29.90 Updated invoice information Part number: 001234 Description: Yellow Hammer Quantity: 3 Price: 19.49

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

6. Be able to choose and prepare a training site.

Answered: 1 week ago