0
Sales tax
Please guys what is wrong with this code
8 Respuestas
+ 1
Ok
0
which code?
0
package sales;
import java.util.Scanner;
public class salestax {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.print( "Enter amount:");
double amount = input.nextdouble();
double tax = amount *0.6;
System.out.print("Sales tax is £"+( int)(tax*100)/100);
}
}
0
Where are you trying this?
In Sololearn packages don't work.
Comment first line
//package sales
0
No , not in sololean
0
//Emmanuel Arhinful read comments.. here is Corrected code
//package sales; // comment it in SL
import java.util.Scanner;
public class salestax {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.print( "Enter amount:");
double amount = input.nextDouble(); //use Capital D in nexdouble
double tax = amount *0.6;
System.out.print("Sales tax is £"+( int)(tax*100)/100); //its same as (int)tax just.
}
}
// hope it helps..
0
It is still not running
0
What is the error?
I tested here in SL to correct it. It working fine.. Try in run and see in SL here..