A. Create a class called Involce (ild) that a hardware store use for an Item sold at the store. An Invoice class should include: 1. Four instance variables:part name (type String), part descriptlon (type String), quantity of the item being purchased (type int) and price per Item (double). 2. Constructor with the arguments for the four instance variables. 3. Constructor with the arguments for part number, quantlty and price per Item. 4. A method named InvoiceAmount that calculates the invoice amount () by 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 program to print invoice amount in case sold n item at the store,
A. Create a class called Involce (ild) that a hardware store use for an Item sold at the store. An Invoice class should include: 1. Four instance variables:part name (type String), part descriptlon (type String), quantity of the item being purchased (type int) and price per Item (double). 2. Constructor with the arguments for the four instance variables. 3. Constructor with the arguments for part number, quantlty and price per Item. 4. A method named InvoiceAmount that calculates the invoice amount () by 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 program to print invoice amount in case sold n item at the store,
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 2PE
Related questions
Question
in java
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,