×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Create A Program to Create Two Invoice Objects in Python Assignment Solution

June 25, 2024
Prof. James Harper
Prof. James
🇦🇪 United Arab Emirates
Python
Prof. James Harper is an experienced software developer and educator with a Master's degree in Computer Science from the University of Melbourne. With over 900 completed assignments, he specializes in Python programming and application development. Prof. Harper's passion for teaching and extensive industry experience ensure that his solutions are not only functional but also well-documented and easy to understand.
Key Topics
  • Instructions
  • Requirements and Specifications
Tip of the day
Use Python libraries effectively by importing only what you need. For example, if you're working with data, using libraries like pandas and numpy can save time and simplify complex tasks like data manipulation and analysis.
News
In 2024, the Biden-Harris Administration has expanded high-dosage tutoring and extended learning programs to boost academic achievement, helping programming students and others recover from pandemic-related setbacks. These initiatives are funded by federal resources aimed at improving math and literacy skills​

Instructions

Objective

Write a program to create two invoice objects solution in python.

Requirements and Specifications

  • For this assignment, refer to page 425 of your textbook. Complete the python assignment 10.10 and create the Invoice class as per instruction. (30 points)
  • Once you have written the class, write a program that creates two Invoice Objects to hold the following data: (30 points)
  • Part NumDescriptionQuantityPriceTotal
    1001Hammer2015300
    1001Locks15575
  • 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 (25 points)

Submit your finished code solution file(s) through the assignment link below:

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

Screenshots

program to create two invoice objects in python

Source Code

# A brief description of the project # Date # CSC121 M8Pro – Invoice Class # Your Name class Invoice: def __init__(self, number, description, quantity, price): self.number = number self.description = description self.quantity = quantity self.price = price def get_number(self): return self._number def set_number(self, value): self._number = value def get_description(self): return self._description def set_description(self, value): self._description = value def get_quantity(self): return self._quantity def set_quantity(self, value): self._quantity = value def get_price(self): return self._price def set_price(self, value): self._price = value def calculate_invoice(self): return self.price * self.quantity number = property(get_number, set_number) description = property(get_description, set_description) quantity = property(get_quantity, set_quantity) price = property(get_price, set_price) def main(): """ Algorithm: 1. Creating to invoice objects for given invoice parameters 2. Print header, using python string formatting with 15 chars per column 3. Print invoice #1 parameters, using python string formatting with 15 chars per column. Total amount is calculated by calculate_invoice() instance method3. 4. Print invoice #2 parameters, using python string formatting with 15 chars per column. Total amount is calculated by calculate_invoice() instance method """ i1 = Invoice('1001', 'Hammer', 20, 15.0) i2 = Invoice('1002', 'locks', 15, 5.0) print('{:<15}'.format('Part Num'), '{:<15}'.format('Description'), '{:<15}'.format('Quantity'), '{:<15}'.format('Price'), '{:<15}'.format('Total'), sep='') print('---------------------------------------------------------------------------') print('{:<15}'.format(i1.number), '{:<15}'.format(i1.description), '{:<15}'.format(str(i1.quantity)), '{:<15}'.format(str(i1.price)), '{:<15}'.format(str(i1.calculate_invoice())), sep='') print('{:<15}'.format(i2.number), '{:<15}'.format(i2.description), '{:<15}'.format(str(i2.quantity)), '{:<15}'.format(str(i2.price)), '{:<15}'.format(str(i2.calculate_invoice())), sep='') print('---------------------------------------------------------------------------') if __name__ == '__main__': main()

Similar Samples

Need expert help with your programming homework? Our team of experienced programmers is here to assist you with high-quality solutions tailored to your requirements. Whether it's debugging, coding, or understanding concepts, we've got you covered. Get reliable support and ace your assignments effortlessly!