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); } } }
2 ответов
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");
}
}
}