Programs
Programs
import java.util.Scanner;
System.out.println("Enter a 5 Digit Number and end with -99 to count even and odd digits:");
while (true)
number = in.nextInt();
if (number == -99)
break;
while (number != 0)
if (digit % 2 == 0)
even++;
}
else
odd++;
number /= 10;
Program 29:
class Credintials
}
public void teacher()//data member of class Credential
System.out.println("The Teacher accompanying Students is Ms. Tina Singh");//printing the name of teacher in-charge
PN.place(); //Data Member of class Credential printing the place in the venue
PN.students(); //Data Member of class Credential printing the number of the students
PN.teacher(); //Data Member of class Credential printing the name of teacher in-charge
Program 30:
class FB
{
System.out.println("Goalkeeper is Messi");
System.out.println("Defender is Ronaldo");
game1.Ball();
game1.Goalkeeper();
game1.Defender();
Program 31:
import java.util.*;
String st;
while(true)
st=in.next();
if(st.equals("."))
break;
System.out.println(st);
}
Program 32:
import java.util.*;
String st;
int c=0;
while(true)
st=in.next();
if(st.equals("the"))
c=c+1;
continue;
System.out.print(st+" ");
//System.out.println("");
if(st.equals("."))
break;
System.out.println("");
Program 33:
public class Half
int a=5,b=4,c=3;
double d;
d=(Math.pow(a,2)+Math.pow(b,2)+Math.pow(c,2))/a*b*c;
System.out.println("Answer = "+d);
Program 34:
import java.util.*;
String st1,st2;
st1=in.next();
st2=in.next();
if(st1.compareTo(st2)<0)
System.out.println(st1+" , "+st2);
else if(st1.compareTo(st2)>0)
System.out.println(st2+" , "+st1);
else
Program 35:
System.out.println ("Rate of Interest is Rupees = " + amt); // Prints the total amount