Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions