Issue
i want the code to calculate the netpay formula. This is the code I used, it has no errors in the program but when I run it, it just says build success and doesn't calculate.
package com.mycompany.netpay;
public class NetPay {
public static void main(String[] args) {
}
double h = 40;
double i = 2.00;
double t = 0.22;
double w = 5.00;
double result = (h * w - i) - t * (h * w - i);
}
Solution
Typically you need your code within the method, not out of it. Try this :)
package com.mycompany.netpay;
public class NetPay {
public static void main(String[] args) {
double h = 40;
double i = 2.00;
double t = 0.22;
double w = 5.00;
double result = (h * w - i) - t * (h * w - i);
// System.out.println(result);
}
}
You're not logging this out to the console or system however, so you may still not see a result. Search "How to print to system in Java" for more information.
Answered By - Matthew Spence
Answer Checked By - Mary Flores (JavaFixing Volunteer)