//Unsolved Program 1
import [Link].*;
public class DiscountPrice
{
void Discount(int d1)
{
Scanner sc=new Scanner([Link]);
int ap,d,price;
[Link]("Enter the price of an article: ");
price=[Link]();
d=price*d1/100;
ap=price-d;
[Link]("Amount paid by the customer after single discount: "+ap);
}
void Discount(int d1, int d2)
{
Scanner sc=new Scanner([Link]);
int ap,ap2,d,price,dd;
[Link]("Enter the price of an article: ");
price=[Link]();
d=price*d1/100;
ap=price-d;
dd=ap*d2/100;
ap2=ap-dd;
[Link]("Amount paid by the customer after two successive discount's: "+ap2);
}
void Discount(int d1, int d2, int d3)
{
Scanner sc=new Scanner([Link]);
int ap,ap2,ap3,d,price,dd,ddd;
[Link]("Enter the price of an article: ");
price=[Link]();
d=price*d1/100;
ap=price-d;
dd=ap*d2/100;
ap2=ap-dd;
ddd=ap2*d3/100;
ap3=ap2-ddd;
[Link]("Amount paid by the customer after three successive discount's: "+ap3);
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
int dis1,dis2,dis3,dis4,dis5,dis6;
[Link]("Enter the Ist discount: ");
dis1=[Link]();
DiscountPrice pr=new DiscountPrice();
[Link](dis1);
[Link]("Enter the two successive discount's: ");
dis2=[Link]();
dis3=[Link]();
[Link](dis2,dis3);
[Link]("Enter the three successive discount's: ");
dis4=[Link]();
dis5=[Link]();
dis6=[Link]();
[Link](dis4,dis5,dis6);
}
}
//Unsolved Program 2
import [Link].*;
public class ArmstrongNumber
{
int Armstrong(int n)
{
int onum,rem,cube=0,f=1;
onum=n;
while(n!=0)
{
rem=n%10;
cube=cube+rem*rem*rem;
n=n/10;
}
if(cube==onum)
f=1;
else
f=0;
return f;
}
public static void main(String args[])
{
ArmstrongNumber ob=new ArmstrongNumber();
Scanner sc=new Scanner([Link]);
int n,ans;
[Link]("Enter a 3-digits number: ");
n=[Link]();
if(n>=100 && n<999)
{
ans=[Link](n);
if(ans==1)
[Link]("It is Armstrong");
else
[Link]("It is not Armstrong");
}
else
[Link]("Entered number is not a 3-digits number");
}
}
//Unsolved Program 3
import [Link].*;
public class PronicNumber
{
int Pronic(int num)
{
int i,k=0;
for(i=1;i<=num;i++)
{
if(i*(i+1)==num)
{
k=1;
break;
}
}
if(k==1)
return 1;
else
return 0;
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter a number: ");
int num=[Link]();
PronicNumber ob=new PronicNumber();
int result=[Link](num);
if(result==1)
{
[Link](num+" is pronic number");
}
else
{
[Link](num+" is not pronic number");
}
}
}
//Unsolved Program 4
import [Link].*;
public class Factor
{
void fact(int n)
{
int i;
for(i=2;i<=n;i++)
{
if(n%i==0)
break;
}
[Link]("First factor of "+n+" is: "+i);
[Link]("Ist and 2nd factors of "+n+" are : "+ i+","+(n/i));
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter a two digit number: ");
int n=[Link]();
if(n>=10 && n<=99)
{
Factor ob=new Factor();
[Link](n);
}
else
{
[Link]("Entered number is not a two digit number");
}
}
}
//Unsolved Program 5
import [Link].*;
public class Factorial
{
double fact(int n)
{
long i,f=1;
for(i=1;i<=n;i++)
{
f=f*i;
}
return f;
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter the value of m: ");
int m=[Link]();
[Link]("Enter the value of n: ");
int n=[Link]();
Factorial ob=new Factorial();
if(n>m && n>0 && m>0)
{
double S=[Link](n)/([Link](m)*[Link](n-m));
[Link]("S: "+S);
}
else
{
[Link]("Both n and m should be +ve and value of n>m");
}
}
}
//Unsolved Program 6
import [Link].*;
public class Area
{
void area()
{
Scanner sc=new Scanner([Link]);
[Link]("Enter 1 to find area of circle");
[Link]("Enter 2 to find area of square");
[Link]("Enter 3 to find area of rectangle");
[Link]("Enter your choice: ");
int ch=[Link]();
switch(ch)
{
case 1: [Link]("Enter the radius of the circle: ");
double r=[Link]();
[Link]("Area of circle: "+(3.14*r*r));
break;
case 2: [Link]("Enter the side of a square: ");
double s=[Link]();
[Link]("Area of square: "+(s*s));
break;
case 3: [Link]("Enter the length of a rectangle: ");
double l=[Link]();
[Link]("Enter the length of a rectangle: ");
double b=[Link]();
[Link]("Area of rectangle: "+(l*b));
break;
default: [Link]("Invalid Choice");
}
}
public static void main(String args[])
{
Area ob=new Area();
[Link]();
}
}
//Unsolved Program 7
import [Link].*;
public class GcdLcm
{
void Glcm(int a, int b)
{
int t,p=a*b;
while(a%b!=0)
{
t=a%b;
a=b;
b=t;
}
[Link]("Greatest common divisor is: "+b);
int lcm=p/b;
[Link]("Lowest common multiple is: "+lcm);
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter the Ist number: ");
int a=[Link]();
[Link]("Enter the 2nd number: ");
int b=[Link]();
GcdLcm ob=new GcdLcm();
[Link](a,b);
}
}
//Unsolved Program 8
import [Link].*;
public class MagicString
{
void Magic(String str)
{
int i,len=[Link]();
char ch1,ch2;
int k=0;
for(i=0;i<len-1;i++)
{
ch1=[Link](i);
ch2=[Link](i+1);
if(ch2-ch1==1)
{
k=1;
break;
}
}
if(k==1)
[Link]("It is a Magic String");
else
[Link]("It is not a Magic String");
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter a word: ");
String str=[Link]();
MagicString ob=new MagicString();
[Link](str);
}
}
//Unsolved Program 9
import [Link].*;
public class Palindrome
{
void Palin()
{
Scanner sc=new Scanner([Link]);
[Link]("Enter a word: ");
String x=[Link]();
int i,len=[Link]();
char ch;
String reverse="";
for(i=0;i<len;i++)
{
ch=[Link](i);
reverse=ch+reverse;
}
if([Link](reverse)==0)
[Link]("Palindrome");
else
[Link]("Not a Palindrome");
}
public static void main(String args[])
{
Palindrome ob=new Palindrome();
[Link]();
}
}
//Unsolved Program 10
import [Link].*;
public class Consonants
{
void Display(String str)
{
int i,len=[Link]();
char ch;
for(i=0;i<len;i++)
{
ch=[Link](i);
if([Link](ch))
{
if(ch!='a' && ch!='e' && ch!='i' && ch!='o' && ch!='u' && ch!='A' && ch!='E' && ch!='O' && ch!='I' && ch!='U')
[Link](ch);
}
}
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter a word: ");
String str=[Link]();
Consonants ob=new Consonants();
[Link](str);
}
}
//Unsolved Program 11
import [Link].*;
public class CaseChange
{
void Change(String str)
{
int i,len=[Link]();
char ch;
for(i=0;i<len;i++)
{
ch=[Link](i);
if(ch==' ')
{
if([Link]([Link](i+1)))
[Link]([Link]([Link](i+1)));
else
[Link]([Link]([Link](i+1)));
}
}
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter a sentence: ");
String str=[Link]();
str=' '+str;
CaseChange ob=new CaseChange();
[Link](str);
}
}
//Unsolved Program 12
import [Link].*;
public class IncomeTax
{
void Tax(String name, int income)
{
double tax=0.0;
if(income<=250000)
tax=0.0;
else if(income<=500000)
tax=(income-250000)*10.0/100.0;
else if(income<=1000000)
tax=30000+(income-500000)*20.0/100.0;
else
tax=50000+(income-1000000)*30.0/100.0;
[Link]("Name of the employee: "+name);
[Link]("Income Tax: "+tax);
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter the name of the employee: ");
String name=[Link]();
[Link]("Enter the annual income: ");
int income=[Link]();
IncomeTax ob=new IncomeTax();
[Link](name,income);
}
}
//Unsolved Program 13
import [Link].*;
public class FirstCharacter
{
void First(String str)
{
int i,len=[Link]();
char ch;
for(i=0;i<len;i++)
{
ch=[Link](i);
if(ch==' ')
[Link]([Link](i+1));
}
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter a sentence: ");
String str=[Link]();
str=' '+str;
FirstCharacter ob=new FirstCharacter();
[Link](str);
}
}
//Unsolved Program 14
import [Link].*;
public class LinearSearch
{
void Search(int m[],int ns)
{
int i,k=0;
for(i=0;i<10;i++)
{
if(m[i]==ns)
{
k=1;
break;
}
}
if(k==1)
[Link]("Number is present");
else
[Link]("Number is not present");
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
int m[]=new int[10],i,ns;
[Link]("Enter 10 numbers: ");
for(i=0;i<10;i++)
{
m[i]=[Link]();
}
[Link]("Enter the number to be searched: ");
ns=[Link]();
LinearSearch ob=new LinearSearch();
[Link](m,ns);
}
}
//Unsolved Program 15
import [Link].*;
public class AreaOverloaded
{
void area(double base, double height)
{
[Link]("Area of parallelogram: "+(base*height));
}
void area(float d1,float d2)
{
[Link]("Area of rhombus: "+(1.0/2.0*d1*d2));
}
void area(double a, double b, double h)
{
[Link]("Area of trapezium: "+(1.0/2.0*(a*b)*h));
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
AreaOverloaded ob=new AreaOverloaded();
[Link]("Enter the base and height of parallelogram: ");
double base=[Link]();
double height=[Link]();
[Link](base,height);
[Link]("Enter the length diagonals of rhombus: ");
float d1=[Link]();
float d2=[Link]();
[Link](d1,d2);
[Link]("Enter the length of || sides and perpendicular distance of trapezium: ");
double a=[Link]();
double b=[Link]();
double h=[Link]();
[Link](a,b,h);
}
}
//Unsolved Program 16
import [Link].*;
public class PerimeterOverloaded
{
void perimeter(double s)
{
[Link]("Perimeter of square: "+(4*s));
}
void perimeter(float l,float b)
{
[Link]("Perimeter of rectangle: "+(2*(l*b)));
}
void perimeter(float r)
{
[Link]("Perimeter of circle: "+(2*3.14*r));
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
PerimeterOverloaded ob=new PerimeterOverloaded();
[Link]("Enter the side of square: ");
double s=[Link]();;
[Link](s);
[Link]("Enter the length and breadth of rectangle: ");
float l=[Link]();
float b=[Link]();
[Link](l,b);
[Link]("Enter the radius of circle: ");
float r=[Link]();
[Link](r);
}
}
//Unsolved Program 17
import [Link].*;
public class DisplayOverloaded
{
void display(String str, int p)
{
int i,len=[Link]();
char ch;
for(i=0;i<len;i++)
{
ch=[Link](i);
if([Link](ch))
{
if(p==1)
{
if([Link](ch))
[Link](ch);
}
else
{
if([Link](ch))
[Link](ch);
}
}
}
}
void display(String str, char chr)
{
int i,len=[Link]();
char ch;
for(i=0;i<len;i++)
{
ch=[Link](i);
if([Link](ch))
{
if(chr=='v')
{
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
[Link](ch);
}
else
[Link](ch);
}
}
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
DisplayOverloaded ob=new DisplayOverloaded();
[Link]("Enter a string: ");
String str=[Link]();
[Link]("Enter 1 to display uppercase characters for wrong input it will display lowercase characters: ");
int p=[Link]();
[Link](str,p);
[Link]("Enter 'v' to display all the vowels for wrong input it will display all the alphabets: ");
char chr=[Link]().charAt(0);
[Link](str,chr);
}
}
//Unsolved Program 18
import [Link].*;
public class CalculateOverloaded
{
void display(int m, char ch)
{
if(ch=='s')
{
if(m%7==0)
[Link]("Divisble by 7");
else
[Link]("Not divisble by 7");
}
else
{
if(m%10==7)
[Link]("Number ends with 7");
else
[Link]("Number not ends with 7");
}
}
void display(int a, int b, char ch)
{
if(ch=='g')
{
if(a>b)
[Link](a+" is greater");
else
[Link](b+" is greater");
}
else
{
if(a<b)
[Link](a+" is smaller");
else
[Link](b+" is smaller");
}
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
CalculateOverloaded ob=new CalculateOverloaded();
[Link]("Enter a number: ");
int m=[Link]();
[Link]("Enter 's' to check the number is divisible by 7 for wrong input check last digit is 7 or not :");
char ch1=[Link]().charAt(0);
[Link](m,ch1);
[Link]("Enter two numbers: ");
int a=[Link]();
int b=[Link]();
[Link]("Enter 'g' to display greater numner wrong input it will display smaller number: ");
char ch2=[Link]().charAt(0);
[Link](a,b,ch2);
}
}
//Unsolved Program 19
import [Link].*;
public class CompareOverloaded
{
void compare(int n1, int n2)
{
if(n1>n2)
[Link](n1+" is greater");
else
[Link](n2+" is greater");
}
void compare(char ch1, char ch2)
{
if(ch1>ch2)
[Link](ch1+" is having higher numeric value "+(int)ch1);
else
[Link](ch2+" is having higher numeric value "+(int)ch2);
}
void compare(String str1, String str2)
{
if([Link]()>[Link]())
[Link](str1+ " is longer");
else
[Link](str2+ " is longer");
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
CompareOverloaded ob=new CompareOverloaded();
[Link]("Enter two numbers: ");
int n1=[Link]();
int n2=[Link]();
[Link](n1,n2);
[Link]("Enter two characters: ");
char ch1=[Link]().charAt(0);
char ch2=[Link]().charAt(0);
[Link](ch1,ch2);
[Link]("Enter two strings: ");
String str1=[Link]();
String str2=[Link]();
[Link](str1,str2);
}
}
//Unsolved Program 20
import [Link].*;
public class SeriesOverloaded
{
double series(double n)
{
double sum=0.0;
int i;
for(i=1;i<=n;i++)
{
sum=sum+(double)1/i;
}
return sum;
}
double series(double a,double n)
{
double sum=0.0;
int i,j;
for(i=1,j=1;i<=n;i++,j+=3)
{
sum=sum+(double)j/[Link](a,j+1);
}
return sum;
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter the number of terms, n: ");
int n=[Link]();
[Link]("Enter the value of a: ");
int a=[Link]();
SeriesOverloaded ob=new SeriesOverloaded();
[Link]("Sum of the Ist series: "+[Link](n));
[Link]("Sum of the 2nd series: "+[Link](a,n));
}
}
//Unsolved Program 21
import [Link].*;
public class OverloadedDisplay
{
void display(int num)
{
double sq=[Link]([Link](num));
if(num==sq*sq)
[Link]("Perfect square number");
else
[Link]("Not a perfect square number");
}
void display(String str, char ch)
{
int i,len=[Link](),k=0;
for(i=0;i<len;i++)
{
if([Link](i)==ch)
{
k=1;
break;
}
}
if(k==1)
[Link](ch+" is present in "+str);
else
[Link](ch+" is not present in "+str);
}
void display(String str)
{
int i,len=[Link](),count=0;
char ch;
for(i=0;i<len;i++)
{
ch=[Link](i);
if(!([Link](ch) || [Link](ch) || [Link](ch)))
{
count++;
}
}
[Link]("Number is special characters are: "+count);
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
OverloadedDisplay ob=new OverloadedDisplay();
[Link]("Enter a number: ");
int num=[Link]();
[Link](num);
[Link]("Enter a word: ");
String str=[Link]();
[Link]("Enter the character to be searched: ");
char ch=[Link]().charAt(0);
[Link](str,ch);
[Link](str);
}
}
//Unsolved Program 22
import [Link].*;
public class OverloadDisplay
{
void display(String str,char ch)
{
if(ch==[Link](0) && ch==[Link]([Link]()-1))
[Link]("Special word");
else
[Link]("Not a special word");
}
void display(String str1, String str2 )
{
if([Link](str2)==0)
[Link]("Equal");
else
[Link]("Not equal");
}
void display(String str, int n)
{
if(n>=1 && n<=[Link]())
{
[Link]("Character present at "+n+" position is: "+[Link](n-1));
}
else
{
[Link]("Invalid Position");
}
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
OverloadDisplay ob=new OverloadDisplay();
[Link]("Enter a word: ");
String str=[Link]();
[Link]("Enter a character: ");
char ch=[Link]().charAt(0);
[Link](str,ch);
[Link]("Enter the Ist word: ");
String str1=[Link]();
[Link]("Enter the 2nd word: ");
String str2=[Link]();
[Link](str1,str2);
[Link]("Enter the position of character to be printed: ");
int n=[Link]();
[Link](str,n);
}
}
//Unsolved Program 23
import [Link].*;
public class VolumeOverloaded
{
double volume(double r)
{
return 4.0/3.0*3.14*r*r*r;
}
double volume(double h, double r)
{
return 3.14*r*r*h;
}
double volume(double l, double b, double h)
{
return l*b*h;
}
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
VolumeOverloaded ob=new VolumeOverloaded();
[Link]("Enter the radius of sphere: ");
double r=[Link]();
[Link]("Volume of the sphere: "+[Link](r));
[Link]("Enter the height and radius of cylinder: ");
double h=[Link]();
double r1=[Link]();
[Link]("Volume of the cylinder: "+[Link](h,r1));
[Link]("Enter the l, b and h of cuboid: ");
double l=[Link]();
double b=[Link]();
double h1=[Link]();
[Link]("Volume of the cuboid: "+[Link](l,b,h1));
}
}