CJCoding With Joseph
15free / daySign inCreate account

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 the output shown in Expected Output.

For a total of 50 the program prints:
50

Expected Output:

180

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Encapsulation
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.