CJCoding With Joseph
15free / daySign inCreate account

Two Properties, One Field

Create a class Temperature backed by a private double celsius. A Celsius property reads and writes that field. A read-only Fahrenheit property returns celsius * 9 / 5 + 32. Do not write a Main method.

After setting Celsius to 100, the program prints the Fahrenheit value (see Expected Output).

Expected Output:

212

= 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.