Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

5. What would be the costs and benefits of making these changes?

Answered: 1 week ago