Home > DeveloperSection > Forums > Multiply percantage values
Nigel Bunyan
Nigel Bunyan

Total Post:20

Posted on    December-08-2015 12:43 AM

 Java Java 

 1 Reply(s)
 475  View(s)
Rate this:
I need to multiply a double value by 12%, how can I do so?

public class AnnualMaintenanceFee {
  public void GetTotal(int TotalND) {
    double software=1500;
    double TNDWithSof= 1500+TotalND;
    double AMF= TNDWithSof 12;
    System.out.println("New Total: "+AMF);

Mayank Tripathi
Mayank Tripathi

Total Post:397

Posted on    December-08-2015 1:12 AM

We can do it like this 

double AMF= TNDWithSof * 0.12; // 0.12 means 12/100(12%), you can use 0.12 directly
System.out.println("New Total: "+AMF);

Don't want to miss updates? Please click the below button!

Follow MindStick