Using switch case write a menu driven program in java to display first 5 upper case letters and last 5 lower case letters
Answers
Answered by
2
Answer:
Hope you like the code !!!
Explanation:
import java.util.Scanner;
public class Main
{
public static void main (String [] args)
{
Scanner sc=new Scanner (System.in);
int a,val;
System.out.println("Select an option :");
System.out.println("1. Upper Case");
System.out.println("2. Lower Case");
a=sc.nextInt();
switch (a)
{
case 1:
System.out.println("The 5 Upper Case letters are : A,B,C,D,E.....");
System.out.println("Do you want to continue ? Press 1 for 'Yes' and any other key for 'No'");
val=sc.nextInt();
if(val==1)
System.out.println("2. Lower Case");
else if(val!=1)
break;
case 2:
System.out.println("The 5 lower case letters are : a,b,c,d,e.....");
break;
default:
System.out.println("Incorrect input");
}
}
}
Similar questions
CBSE BOARD X,
5 months ago
Math,
5 months ago
Social Sciences,
10 months ago
Math,
10 months ago
Hindi,
1 year ago
Math,
1 year ago
Hindi,
1 year ago