0
import java.util.Scanner;
public class ats
{
    public static void main(String[]args)
    {
        double baseats;
        int bonusats;
        int level;
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter base attackspeed: ");
        baseats = sc.nextDouble();
        System.out.print("Enter bonus attack speed %: ");
        bonusats = sc.nextInt();
        System.out.print("Enter the level: ");
        level = sc.nextInt();
        double as = baseats * (1 + (bonusats / 100) * (level - 1));
        
        System.out.printf("The character's current attack speed is: %.3f", as);
    }
}

This is my code so far and when it calculates it brings me the same result as the entered base attack speed. this should be the result of the program

  • Use a debugger and check the values of your variables. If you don't have a debugger or don't know how to use one, add `System.out.println` statements to the print the values of your variables. – knittl Nov 16 '21 at 06:25
  • `bonusats / 100` is Integer division see https://stackoverflow.com/questions/4685450/int-division-why-is-the-result-of-1-3-0 – Scary Wombat Nov 16 '21 at 06:28

0 Answers0