+ 1
Java introduction/ System for bank clients/ block
Hi! Please check my code for this task as The Ai coupdn't sugget anz new and it seem it fulfils the req. still 1st test case is wrong: switch(number){ case 1: System.out.println("Langauge selection"); break; case 2: System.out.println("Customer support"); break; case 3: System.out.println("Check the balance"); break; case 0: System.out.println("Exit"); break; } } while(number!=0); } }
9 odpowiedzi
+ 3
Could you tell me what exactly the code is supposed to do and what the input data was in 1 test? Since I don’t have a pro subscription, I can’t view this task, it’s quite difficult to say what exactly is wrong.
+ 3
There seems to be a do while loop, but „do“ at beginning of this code is forgotten.
+ 3
case 1:
System.out.println("Langauge selection");
// you misspelled the word "language" correctly "langUage" but not "langAuge"
+ 1
Thanks a lot. I couldn't even imagine that it was beacuse if the spelling. I was looking for tha cause in the code for a week now....
+ 1
الرجاء عدم إرسال بريد عشوائي لمنتدى الأسئلة والأجوبة ادم محمد الصالح
0
import java.util.Scanner;
class Demo{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int number;
do {
number = scanner.nextInt();
/* output corresponding message
1 => Language selection
2 => Customer support
3 => Check the balance
0 => Exit
*/
switch(number){
case 1:
System.out.println("Langauge selection");
break;
case 2:
System.out.println("Customer support");
break;
case 3:
System.out.println("Check the balance");
break;
case 0:
System.out.println("Exit");
break;
default:
System.out.println("input is invalid");
break;
}
}
while(number!=0);
}
}
0
This is the full code! I'd really appricate if you could help.
0
An the task is:
"System for bank clients
You are creating an automated phone system for bank clients.
Number selections should activate the actions noted below as follows:
• 1 => Language selection
• 2 => Customer support
• 3 => Check account balance
• 0 => Exit
You can use the first 3 commands in a random sequence without interrupting the phone call - only the number 0 interrupts it. The given code takes numbers continuously.
Task:
Complete the code to output the corresponding messages, until the client enters 0.
Sample Input:
1
3
0
Sample Output:
Language selection
Check the balance
Exit"