Question: Use C# to Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store.

Use C# to 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 the following pieces of information as private instance fields: A part number (type string) A part name (type string) A part description (type string) A part manufacturer's name (type string) An invoice number (type string) An invoice date(type string) A quantity of the item being purchased (type int) A price per item (decimal). For the int variable, provide a property named Quantity with a get and set accessor. For the decimal variable, provide a property named PricePerItem with a get and set accessor. For each string variable, provide an indexer with a get and set accessor. Provide a method named GetInvoiceAmount that calculates the invoice amount (i.e., multiplies the quantity by the price per item), then returns the amount as a decimal value. Write a test class named InvoiceTest that demonstrates class Invoices the following capabilities: Create an instance by calling its default constructor, Assign the value of each instance variable via the indexers and properties, Call the method GetInvoiceAmount, Get the new value of each variable via its property or indexer.

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!