You are on page 1of 5

import java.io.

*;

import java.lang.String;

import java.lang.Math;

public class Exam

{ String str;int num;

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

Exam()throws IOException

int ch;

do{

System.out.println("1. Enter the name");

System.out.println("2. Enter the number");

System.out.println("3. Uppercase & Lowercase conversion");

System.out.println("4. Cube & Sum");

System.out.println("5. Vowel Counts");

System.out.println("Enter your choice:- ");

ch=Integer.parseInt(br.readLine());

switch(ch)

case 1: read();

break;

case 2: read1();

break;

case 3: toggle();

break;

case 4: cubs();

break;

case 5: Vowel();

break;

case 6: break;
default:System.out.println("Invalid choice");

} }while(ch!=6);

public void read()throws IOException

System.out.println("Name:- ");

str=br.readLine();

System.out.println(str);

public void read1()throws IOException

System.out.println("Number");

num=Integer.parseInt(br.readLine());

System.out.println("num");

public void toggle()throws IOException

char a;

String togg="";

for (int i=0;i<str.length();i++ )

if(Character.isUpperCase(str.charAt(i)))

a=Character.toLowerCase(str.charAt(i));

togg=togg+a;

else if(Character.isLowerCase(str.charAt(i)))

{
a=Character.toUpperCase(str.charAt(i));

togg=togg+a;

System.out.println(togg);

public void cubs()throws IOException

int rem,sq,temp=num,sum=0;

do

rem=temp%10;

sq=(int)Math.pow(rem,3);

sum=sum+sq;

temp=temp/10;

}while(temp!=0);

System.out.println(sum);

public void Vowel()throws IOException

int count=0;

for (int i=0;i<str.length();i++)

if(str.charAt(i)=='a')

count++;

else if (str.charAt(i)=='e')

count++;

}
else if (str.charAt(i)=='i')

count++;

else if (str.charAt(i)=='o')

count++;

else if (str.charAt(i)=='u')

count++;

else if (str.charAt(i)=='A')

count++;

else if (str.charAt(i)=='E')

count++;

else if (str.charAt(i)=='I')

count++;

else if (str.charAt(i)=='O')

count++;

else if (str.charAt(i)=='U')

count++;
}

System.out.println(count);

public static void main(String args[])throws IOException

Exam obj = new Exam();