Python Programming- Invoice Class Introduction: Requires creating classes and instantiating objects from created class Instructions: 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 data attributes--a part number (a string), a part description (a string), a quantity of the item being purchased (an int.) and a price per item (a Decimal). Your class shold have an __init__ method that intializes the four data ttributes. Provide a property for each data attribute. The quantity and price per item should each be non-negative--use validation in the properties for these data attributes to ensure that they remain valid. Provide a calculate_invoice method that returns the invoice amount (that is, multiplies the quantity by the price per item). Demonstrate class Invoice's capabilities. Once you have written the class, write a program that creates two Invoice Objects to hold the following data:  ________________________________________________________________________________ Part Num             Description         Quantity              Price                      Total ________________________________________________________________________________ 1001                       Hammer              20                           15                     300 1002                       locks                      15                           5                      75      The program should store this data in the two objects, then display the object information in the manner shown in the table above , note that the total is NOT hardcoded, it’s calculated based on the item’s quantity and price.   Note: Write program Pseudocode (detail algorithm) and add it as a comment block to the program.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question
100%

Python Programming- Invoice Class

Introduction:

Requires creating classes and instantiating objects from created class

Instructions:

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 data attributes--a part number (a string), a part description (a string), a quantity of the item being purchased (an int.) and a price per item (a Decimal). Your class shold have an __init__ method that intializes the four data ttributes. Provide a property for each data attribute. The quantity and price per item should each be non-negative--use validation in the properties for these data attributes to ensure that they remain valid. Provide a calculate_invoice method that returns the invoice amount (that is, multiplies the quantity by the price per item). Demonstrate class Invoice's capabilities.

  1. Once you have written the class, write a program that creates two Invoice Objects to hold the following data: 

________________________________________________________________________________

Part Num             Description         Quantity              Price                      Total
________________________________________________________________________________

1001                       Hammer              20                           15                     300

1002                       locks                      15                           5                      75   

 

  1. The program should store this data in the two objects, then display the object information in the manner shown in the table above , note that the total is NOT hardcoded, it’s calculated based on the item’s quantity and price.

 

Note: Write program Pseudocode (detail algorithm) and add it as a comment block to the program.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Data members
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
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