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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!