0

Skee-ball cod help. Java

I’m pretty bad in math which makes programming hard for me. Anyone know any resources to help. I see an easy problem like the skee ball question and I struggle to come up with a simple solution import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int score = sc.nextInt(); int price = sc.nextInt(); double tickets = score * 0.12; if (tickets % price <= 0){ System.out.println("Buy it!"); }else{ System.out.println("Try again"); } } }

28th Feb 2020, 8:23 PM
Yazen
Yazen - avatar
1 Antwort
+ 1
thank you. changed the code to this import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int score = sc.nextInt(); int price = sc.nextInt(); int tickets = score/12; if (tickets >= price){ System.out.println("Buy it!"); }else{ System.out.println("Try again"); } } }
28th Feb 2020, 9:08 PM
Yazen
Yazen - avatar