help me pls | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
- 1

help me pls

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int number=sc.nextInt(); do { //take input and output corresponding message /* 1 => Language selection 2 => Customer support 3 => Check the balance 4 => Check loan balance 0 => Exit */ if (number == 1) { System.out.println("Language selection"); }if(number == 2){ System.out.println("Customer support"); }if(number == 3){ System.out.println("Check the balance"); }if(number == 4){ System.out.println("Check loan balance");break; }if(number == 0){ System.out.println("Exit"); } } while(number != 0); } }

24th Mar 2021, 3:22 PM
Lâm Cao
Lâm Cao - avatar
3 Antworten
+ 1
Try this: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int number=sc.nextInt(); do { //take input and output corresponding message /* 1 => Language selection 2 => Customer support 3 => Check the balance 4 => Check loan balance 0 => Exit */ if (number == 1) { System.out.println("Language selection"); break; }if(number == 2){ System.out.println("Customer support"); break; }if(number == 3){ System.out.println("Check the balance"); break; }if(number == 4){ System.out.println("Check loan balance"); break; }if(number == 0){ System.out.println("Exit"); break; } } while(number != 0); } }
24th Mar 2021, 3:55 PM
vatsal k
vatsal k - avatar
+ 1
thank u i have done and it true
24th Mar 2021, 11:21 PM
Lâm Cao
Lâm Cao - avatar
0
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 4 => Check loan balance 0 => Exit You can use the first 4 commands in a random sequence without interrupting the phone call - only the number 0 does. Write a program that will continuously take a number as input and output the corresponding message, until the client enters 0. Sample Input 1 4 3 0 Sample Output Language selection Check loan balance Check the balance Exit
24th Mar 2021, 3:23 PM
Lâm Cao
Lâm Cao - avatar