0

Sales tax

Please guys what is wrong with this code

13th May 2022, 10:13 AM
Emmanuel Arhinful
Emmanuel Arhinful - avatar
8 Antworten
+ 1
Ok
14th May 2022, 11:44 AM
Emmanuel Arhinful
Emmanuel Arhinful - avatar
0
which code?
13th May 2022, 10:15 AM
Jayakrishna 🇮🇳
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); } }
13th May 2022, 10:15 AM
Emmanuel Arhinful
Emmanuel Arhinful - avatar
0
Where are you trying this? In Sololearn packages don't work. Comment first line //package sales
13th May 2022, 10:19 AM
Jayakrishna 🇮🇳
0
No , not in sololean
13th May 2022, 10:21 AM
Emmanuel Arhinful
Emmanuel Arhinful - avatar
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..
13th May 2022, 10:23 AM
Jayakrishna 🇮🇳
0
It is still not running
13th May 2022, 10:29 AM
Emmanuel Arhinful
Emmanuel Arhinful - avatar
0
What is the error? I tested here in SL to correct it. It working fine.. Try in run and see in SL here..
13th May 2022, 10:31 AM
Jayakrishna 🇮🇳