CJCoding With Joseph
15free / daySign inCreate account

Create a class Volume with a private int level. Its Level property returns the field on get, and on set clamps the incoming value to the range 0 to 100: values below 0 become 0, values above 100 become 100, and any other value is stored as-is. Do not write a Main method.

Setting Level to 150 then reading it prints the output shown in Expected Output.

Expected output

100

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

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