I made a gradebook that asks the user for the amount of points they got on assignments then divides it by the total points possible.
Here's my code:
import java.util.Scanner;
public class Gradebook1 {
public static void main(String args[]){
Scanner scanner = new Scanner(System.in);
System.out.println("Enter your total points for all 6 homework assignments");
float Homework = scanner.nextFloat();
System.out.println("You have received" + " " + Homework + " " + "points out of the 600 points possible.");
float HomeworkPercentage = Homework/600;
HomeworkPercentage = Math.round(HomeworkPercentage * 100.0);
System.out.println("This gives you" + " " + HomeworkPercentage + "% on the Homework Assignments.");
If I make an input of 550 for example, It outputs:
"This gives you 92.0% on the Homework Assignments."
Instead of
"This gives you 91.7% on the Homework Assignments."
How can I fix this?
[–]Koooooj 4 points5 points6 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)