Seeking for solution of Code Coach Challenge 'Skee-Ball' | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Seeking for solution of Code Coach Challenge 'Skee-Ball'

I think I have done everything that needed. But still the test case #3 shows failed. What can I do now? import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner input = new Scanner (System.in); int point = input.nextInt; int gunPrice = input.nextInt; int tickets = point/12; if (tickets > gunPrice) { String msg1 = "Buy it!"; System.out.println(msg1); } else { String msg2 = "Try again"; System.out.println(msg2); } } }

11th Mar 2020, 3:31 PM
Raquibul Islam
Raquibul Islam - avatar
1 Answer
0
import java.util.*; public class Program { public static void main(String[] args) { int points,price; Scanner sc=new Scanner(System.in); points=sc.nextInt(); price=sc.nextInt(); int tickets=points/12; if(tickets>=price) { System.out.println("Buy it!"); } else { System.out.println("Try again"); } } }
13th Apr 2020, 11:21 AM
kartik narang
kartik narang - avatar