Run ❯
Get your
own Java
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
public class Main { public static void main(String[] args) { // Set the maximum possible score in the game to 500 int maxScore = 500; // The actual score of the user int userScore = 423; /* Calculate the percantage of the user's score in relation to the maximum available score. Convert userScore to float to make sure that the division is accurate */ float percentage = (float) userScore / maxScore * 100.0f; // Print the result System.out.println("User's percentage is " + percentage); } }
User's percentage is 84.6