11 D Tue 926 PM a Homework05 Home Insert DesignLayout Refer

@ 11% D Tue 9:26 PM a Homework,05 Home Insert DesignLayout References MailingsReviewV Calibri (Body) B 1 u.shex, x\'iA.O.A. Plaste 0 Styles Styles earn 1.) (Invoice Class) Create a class called Invoice 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-a part number (type String), a part description (type String), a quantity of the item being purchased (type int) and a price per item (double). Your class should have a constructor to initialize the four instance variables. Provide a set and a get method for each instance variable. e the In addition, provide a method ntmed getinvoiceAmount to calculate the invoice amount (i.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 app named Invoice Test to demonstrate class Invoice\'s capabilities. Try to use the JOption Pane class objects as input and output instead of the keyboard. 2.) (Employee Class) Create a class called Employee that includes three instance variables-a first name (type String), a last name (type String) and a monthly salary (double). Provide a constructor to initialize the three instance variables. Provide a set and a get method for each instance variable. If the monthly salary is not positive, do not set its value. Write a test app named Employee Test to demonstrate class Employeo\'s capabilities Create two Employee objects and display each object\'s yearly salary. Then give each Employee a 10% raise and display each Employee\'s yearly salary again. 140 % 4) English (US) 263 Words Page 1 of 1

Solution

Please find the required program along with its output. Please see the comments against each line to understand the step.

2)

--------------------------------------------------

OUTPUT:

Yearly salary :
Employee 1 : 12000.0
Employee 2 : 36000.0
Yearly salary after 10% raise:
Employee 1 : 13200.0
Employee 2 : 39600.00000000001

1)

--------------------------------------------------------------

OUTPUT:

Enter part number
AS12DS
Enter part description
ABCDEFGH
Enter quantity
4
Enter price
68
Invoice amount = 272.0

 @ 11% D Tue 9:26 PM a Homework,05 Home Insert DesignLayout References MailingsReviewV Calibri (Body) B 1 u.shex, x\'iA.O.A. Plaste 0 Styles Styles earn 1.) (In

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site