+ 9
You spell "confirmed" with a capital C, is that correct?
+ 3
You're welcome :)
+ 1
import java.util.Scanner;
public class Program {
//your code goes here
/*
User message: "1", Reply: "Order confirmed"
User message: "2", Reply: "info@sololearn.com"
For any other number, the reply should be: "Try again".
*/
public static void bot() {
Scanner scanner = new Scanner (System.in);
int userInput = scanner.nextInt();
if (userInput==1){
System.out.println("Order confirmed");
}else if(userInput==2){
System.out.println("info@sololearn.com");
}else{
System.out.println("Try again");
}
scanner.close();
}
public static void main(String[] args) {
bot();
}
}
+ 1
THIS IS CORRECT.
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
bot();
}
public static void bot(){
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
switch(num){
case 1:
System.out.println("Order confirmed");
break;
case 2:
System.out.println("info@sololearn.com");
break;
default:
System.out.println("Try again");
}
}
}