CJCoding With Joseph

Computed Property With Logic

Create a class Order whose constructor stores a private double total. Add a read-only property FinalPrice: when total is greater than 100 it returns the total minus one tenth of the total (a 10% discount); otherwise it returns the total unchanged. Do not write a Main method.

For a total of 200 the program prints:
180

For a total of 50 the program prints:
50

Expected Output:

180
Topics:
Encapsulation
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.