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,

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
in java
A. Create a class called Involce (ili) 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, quantity 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,
Transcribed Image Text:A. Create a class called Involce (ili) 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, quantity 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,
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,