Question
C# Please Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. This
C# Please
Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. This class has one instance variable: quantity of the item being purchased (type int). Provide a property with get and set accessors for quantity. If the value passed to the set accessor is negative, the value of the instance variable should be left unchanged. Your class should have a constructor that initializes quantity. In addition, provide a method GetInvoiceAmount that calculates the invoice amount. Assume that the unit price of the item being sold is $0.75. Therefore, the invoice amount equals quantity multiplied by $0.75. Use decimal for variables and values that are related to money. Write a test application named InvoiceTest that demonstrates class Invoices capabilities. In this test application, ask the user to enter quantity. Use it to create an invoice object. Retrieve the value stored in the quantity instance variable (via the get accessor of its corresponding property) and display it. Use the GetInvoiceAmount method to calculate the invoice amount. Display the invoice amount.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started