40.7k views
2 votes
C#

1. Create a new class called StandardSale
2. Add three private fields to the class:
_salesDate, a DateTime
_amount, a double
_quantity, an integer
3. Also, add properties with get and set accessors for each field, call them SalesDate, Amount, and Quantity.
In the "set" accessors, use if/else to limit Amount and Quantity to positive values and
to limit SalesDate to dates on or after 1/1/2000.
Use "else" to set Quantity and Amount to 0 and SalesDate to 1/1/2000 if the input values are invalid.
4. Add a constructor so that all three fields can be populated when a StandardSale object is instantiated.
5. Add a method called TotalSale that returns _amount * _quantity as a double.

User Onionpsy
by
5.4k points

1 Answer

4 votes

Answer:

Hhhhhhjjjjjjkiiiiioooooooooioi

User Tigerware
by
5.2k points