โ Back to Methods
Question 361
Percentage Method
Percentage Method
Write a methodpercent(int part, int whole)that returns what percentagepartis ofwhole, as adouble. Usepart * 100.0 / whole. Call it with1and4and print the result: 25.0 UseSystem.out.println.
Expected Output:
25.0
Topics:
Methods
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.