CJCoding With Joseph

Format a Field as a String

Create a class Battery whose constructor stores a private int level. Add a read-only property Status that returns the level followed by a percent sign, like 80%. Do not write a Main method.

For new Battery(80) the program prints:
80%

Expected Output:

80%
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.