Question
3. Solution Must be In C#. Create a program named SalesTaxDemo that declares an array of 10 Sale objects. Prompt the user for data for
3. Solution Must be In C#.
Create a program named SalesTaxDemo that declares an array of 10 Sale objects. Prompt the user for data for each object and display the 10 objects. The program should accept input and display output in the same format as the sample program output below.
Data fields for Sale objects include:
InventoryNumber - An inventory number (as a string)
amount - Amount of the sale (as a double)
tax - Tax owed (as a double)
Include a property with get and set accessors for the first two data fields, but make the tax owed a read-only property.
The tax should be calculated whenever the amount of the sale is set. Assume that the tax rate is 8 percent for the first $100 and 6 percent for any amount greater than $100.
Sample Program Output:
Enter inventory number #1 >> 1
Enter amount of sale >> 200
Enter inventory number #2 >> 2
Enter amount of sale >> 900
Enter inventory number #3 >> 5
Enter amount of sale >> 1200
Enter inventory number #4 >> 18
Enter amount of sale >> 37000
Enter inventory number #5 >> 12
Enter amount of sale >> 1500
Enter inventory number #6 >> 91
Enter amount of sale >> 100024
Enter inventory number #7 >> 88
Enter amount of sale >> 8091
Enter inventory number #8 >> 102
Enter amount of sale >> 400675
Enter inventory number #9 >> 21
Enter amount of sale >> 1900
Enter inventory number #10 >> 28
Enter amount of sale >> 12000
Sale # 1 Amount: 1 Sale $200.00
Tax is $14.00
Sale # 2 Amount: 2 Sale $900.00
Tax is $56.00
Sale # 3 Amount: 5 Sale $1,200.00
Tax is $74.00
Sale # 4 Amount: 18 Sale $37,000.00
Tax is $2,222.00
Sale # 5 Amount: 12 Sale $1,500.00
Tax is $92.00
Sale # 6 Amount: 91 Sale $100,024.00
Tax is $6,003.44
Sale # 7 Amount: 88 Sale $8,091.00
Tax is $487.46
Sale # 8 Amount: 102 Sale $400,675.00
Tax is $24,042.50
Sale # 9 Amount: 21 Sale $1,900.00
Tax is $116.00
Sale # 10 Amount: 28 Sale $12,000.00
Tax is $722.00
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