Computer Project (2)
Computer Project (2)
char c=a;
char d=b;
int a1=(int)a;
int b1=(int)b;
int diff=a1-b1;
System.out.println("ASCII of"+c+"="+a1);
System.out.println("ASCII of"+d+"="+b1);
}
import java.util.Scanner;
double area=0;
System.out.println("1.... Circle");
System.out.println("2.... Cylinder");
System.out.println("3.... Rectangle");
int ch=sc.nextInt();
switch(ch)
case 1:
System.out.println("Enter radius");
double r=sc.nextDouble();
area=3.14*r*r;
double circum=2*3.14*r;
System.out.println("Area="+area);
System.out.println("Circumference="+circum);
break;
case 2:
System.out.println("Enter radius");
double r1=sc.nextDouble();
System.out.println("Enter Height");
double h=sc.nextDouble();
area=(2*3.14*r1*r1)+(2*3.14*r1*h);
double v=3.14*r1*r1*h;
System.out.println("Total Surface Area="+area);
System.out.println("Volume="+v);
break;
case 3:
System.out.println("Enter length");
double l=sc.nextDouble();
System.out.println("Enter breadth");
double b=sc.nextDouble();
area=l*b;
double p=2*(l+b);
System.out.println("Area="+area);
System.out.println("Perimeter="+p);
break;
default:
}
import java.util.Scanner;
int min=sc.nextInt();
int p=0;
if(min<=5)
p=9;
p=9+7;
p=9+7+5;
p=9+7+5+3;
System.out.println("Price=Rs."+p);
}
import java.util.Scanner;
String s=sc.nextLine();
double cost=sc.nextDouble();
double d=0,amt=0;
if(s=="LandPhone")
d=50.0/100.0*cost;
else if(s=="Mobile")
d=30.0/100.0*cost;
else if(s=="Tab")
d=25.0/100.0*cost;
else if(s=="Laptop")
d=40.0/100.0*cost;
else
d=10.0/100.0*cost;
amt=cost-d;
System.out.println("Discount="+d);
System.out.println("Amount to be paid="+amt);
}
public class Digits
int r=0,c1=0,cev=0,cod=0;
while(a>0)
r=a%10;
if(r%2==0)
cev++;
else
if(r==1)
c1++;
else
cod++;
a=a/10;
System.out.println("Even Digits="+cev);
System.out.println("Odd Digits="+cod);
System.out.println("No. of 1s="+c1);
}
import java.util.Scanner;
int ch=sc.nextInt();
int i=0,j=0;
switch(ch)
case 1:
int a=100,b=0;
for(i=1;i<=12;i++)
a=a+5;
b=b+5;
break;
case 2:
for(i=1;i<=5;i++)
for(j=i;j<=5;j++)
System.out.print(j);
System.out.println();
}
import java.util.Scanner;
boolean ans=false;
int c=0;
for(int i=1;i<=a;i++)
if(a%i==0)
c++;
if(c==2)
ans=true;
else
ans=false;
return ans;
boolean ans1=false;
int r=0,b1=b,s=0;
while(b>0)
r=b%10;
s=s+(r*10);
b=b/10;
if(s==b1)
ans1=true;
else
ans1=false;
return ans1;
int r1=0,d=1,c1=0,s1=0;
for(int j=100;j<=999;j++)
int j1=j;
if(j1%d==0)
c1++;
while(j>0)
r1=j%10;
s1=s1+(r1*10);
j=j/10;
d++;
System.out.print(j1+", ");
System.out.println("Enter 2 nos");
int g=sc.nextInt();
int h=sc.nextInt();
boolean g1=ob.PRIME(g);
boolean h1=ob.PALINDROME(h);
System.out.println(g1+" "+h1);
}
}
import java.util.Scanner;
int Rno,NOD;
String Name;
float Tariff;
Rno=sc.nextInt();
System.out.println("Enter name");
Name=sc.nextLine();
System.out.println("Enter tariff");
Tariff=sc.nextFloat();
System.out.println("Enter NOD");
NOD=sc.nextInt();
double amt=0;
amt=NOD*Tariff;
if(amt>10000)
amt=1.05*NOD*Tariff;
return amt;
double amt1=ob.Compute();
System.out.println("Name:"+Name);
System.out.println("Room No.:"+Rno);
System.out.println("Tariff:"+Tariff);
System.out.println("NOD:"+NOD);
System.out.println("Amount:Rs."+amt1);