Java arithmetics for calculating a percentage

后端 未结 8 682
一个人的身影
一个人的身影 2021-01-21 14:00

I have a little problem in my java application.

I have to calculate the score they have when they finish, I use this method:

public Float ScoreProcent(in         


        
8条回答
  •  时光说笑
    2021-01-21 14:15

    I will try explain other way:

    float hoursWorked = (float) 32.5;
    final double HOURLY_RATE = 9.35;
    double wages = HOURLY_RATE * hoursWorked;
    final double TAX_RATE = 22; // percentage
    double taxDue = TAX_RATE * wages / 100;
    // to calculate using percentage need to divide by 100
    System.out.print(taxDue);
    

提交回复
热议问题