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
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