0% found this document useful (0 votes)
16 views4 pages

2nd Term Gr10 Anskey

Uploaded by

ryutempest0001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

2nd Term Gr10 Anskey

Uploaded by

ryutempest0001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Question 3 else

if(room.equalsIgnoreCase("Super_Deluxe"))
import java.util.*;
{
public class HotelBooking
totalamt=amt+2000;
{
}
String name,room;
else if(room.equalsIgnoreCase("Deluxe"))
long mobno;
{
double amt,totalamt;
totalamt=amt+1000;
HotelBooking()
}
{
else
name="";
if(room.equalsIgnoreCase("Standard"))
room="";
{
mobno=0L;
totalamt=amt+500;
amt=0.0;
}
totalamt=0.0;
}
}
void display()
void accept()
{
{
System.out.println("Customer
Scanner sc = new Scanner(System.in); name :"+name+"\nRoom Type : "+room+"\
nMobile Number : "+mobno+"\nTotal Amount
System.out.println("Enter name, room : "+totalamt);
type, mobilenumber,basic room tariff");

name=sc.nextLine();

room=sc.next();
}
mobno=sc.nextLong();
public static void main(String args[])
amt=sc.nextDouble();
{
}
HotelBooking ob = new HotelBooking();
void update()
ob.accept();
{
ob.update();
if(room.equalsIgnoreCase("Suite"))
ob.display();
{
}
totalamt=amt+5000;
}
}
Question 4 System.out.println("Character not
present");
import java.util.*;
}
public class Q4
}
{
Question 5
public static void main(String args[])
import java.util.*;
{
public class Q5
Scanner sc = new Scanner(System.in);
{
char c[]={'9','L','M','O','Q','Z','b','d','f','g'};
public static void main(String args[])
int s=c.length;
{
char n;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the character
to be searched"); String s,s1="";

n=sc.next().charAt(0); System.out.println("Enter a sentence");

int l=0,u=s-1,m=0,k=0; s=sc.nextLine();

while(l<=u) int l=s.length();

{ for(int i=0;i<l;i++)

m=(l+u)/2; {

if(n>c[m]) char ch=s.charAt(i);

l=m+1; if(ch>='A'&&ch<='Z')

if(n<c[m]) s1=s1+(int)ch;

u=m-1; else if(ch>='a'&&ch<='z')

if(n==c[m]) s1=s1+(char)(ch-32);

{ else if(ch>='0'&&ch<='9')

k=1; s1=s1+'#';

break; else if(ch==' ')

} s1=s1+'$';

} else

if(k==1) s1=s1+'x';

System.out.println(n+" is present in the }


position "+(m+1));
System.out.println("Original Sentence :
else "+s);
System.out.println("Encoded Sentence : }
"+s1);
System.out.println(sum);
} }
if(((int)sum%2)==0)
Question 6
System.out.println("The array is a perfect
import java.util.*; array");

public class TwoDArray else

{ System.out.println("The array is not a


perfect array"); }}
public static void main(String args[])
Question 7
{
import java.util.*;
Scanner sc = new Scanner(System.in);
public class Strontio
double a[][]=new double[4][4];
{
double sum=0.0;
public static void main(String args[])
System.out.println("Enter the array
elements"); {

for(int i=0;i<4;i++) Scanner sc = new Scanner(System.in);

{ int n;

for(int j=0;j<4;j++) System.out.println("Enter a number");

{ n=sc.nextInt();

a[i][j]=sc.nextDouble(); if(n>=1000&&n<=9999)

sum=sum+a[i][j]; {

} int n1=n;

System.out.println(); int n2=n1*2;

} n2=(n2/10);

System.out.println("Original array in n2=n2%100;


matrix form:");
if((n2%10)==(n2/10))
for(int i=0;i<4;i++)
System.out.println(n+" is a Strontio
{ number");

for(int j=0;j<4;j++) else

{ System.out.println(n+" is not a Strontio


number");
System.out.print(a[i][j]+" ");
}
}
else
System.out.println();
{ while(p>0)

System.out.println("Enter a four digit {


number");
int d=p%10;
} } }
if(d==2||d==3||d==5||d==7)
Question 8
System.out.println(d);
import java.util.*;
p=p/10;
public class Q8
}
{
}
void show()
void show(String s)
{
{
int t=65;
for(int i=1;i<=s.length();i++)
char a='A';
{
for(int i=1;i<=4;i++)
System.out.println(s.substring(0,i));
{
}
for(int j=4;j>=i;j--)
}
{
public static void main(String args[])
if(i%2==0)
{
{
Q8 ob = new Q8();
System.out.print(a+" ");
ob.show();
a++;
ob.show(4329);
}
ob.show("BLUEJ");
else{
}
System.out.print(t+" ");
}
t++;

System.out.println();

void show(int p)

You might also like