Course: Core Skills Module: Problem Solving Topic: Conditional Operations
Course: Core Skills Module: Problem Solving Topic: Conditional Operations
else
max=z;
}
System.out.println("Max: "+max);
}
}
2. Write a program to check whether the input alphabet is a vowel or not.
}
}
3. Develop a program, that accepts a deposit amount and calculates amount of interest
the deposit amount earns in an year. The bank pays a flat 4% for deposits of up to
Rs.1000, a flat 4.5% per year for deposits of up to Rs.5000, and a flat 5% for deposits of
more than Rs.5000.
public class CalculateAmount
{
public static void main(String args[])
{
double deposit_amount=Double.parseDouble(args[0]);
if(deposit_amount<=1000)
System.out.println("The Interest is:"+(deposit_amount*0.04));
else if(deposit_amount>1000&&deposit_amount<=5000)
System.out.println("The interest is :"+
(deposit_amount*0.045));
else if(deposit_amount>5000)
System.out.println("The interest is:"+
(deposit_amount*0.05));
}
}
4. Develop the program, which accepts the gross pay and produces the amount of tax
owed. For a gross pay of $240 or less, the tax is 0%; for over $. 240 and $. 480 or less,
the tax rate is 15%; and for any pay over $480, the tax rate is 28%.
5. Some credit card companies pay back a small portion of the charges a customer makes
over a year. A particular credit card company's pay back policy is as follows:
1. 0.25% for charges up to Rs. 500.
2. 0.50% for the next Rs.1000 (that is, the portion between Rs. 500 and Rs. 1500),
3. 0.75% for the next Rs.1000 (that is, the portion between Rs. 1500 and Rs. 2500),
4. 1.0% for charges above Rs2500.
Thus, a customer who charges Rs. 400 a year receives Rs.1.00, which is 0.25 · 1/100 ·
400, and one who charges Rs1, 400 a year receives Rs. 5.75, which is 1.25 = 0.25 · 1/100
· 500 for the first Rs. 500 and 0.50 · 1/100 · 900 = 4.50 for the next Rs. 900. Determine
by hand the pay backs amount for a customer who charged Rs. 2000 and one who
charged Rs. 2600.
Define the program, which accepts a charge amount and computes the corresponding
pay back amount.
switch (day_week) {
case 0: System.out.println("Sunday");
break;
case 1: System.out.println("Monday");
break;
case 2: System.out.println("Tuesday");
break;
case 3: System.out.println("Wednesday");
break;
case 4: System.out.println("Thursday");
break;
case 5: System.out.println("Friday");
break;
case 6: System.out.println("Saterday");
break;
}
}
}
Write a program that accepts age, gender, job status and assets, and return the eligible loan
amount.
int asset=Integer.parseInt(args[3]);
if ((age>=16)&&(age<=25))
{ if(gender=='M' || gender=='F')
if(asset>25000)
{ if(job.equals("selfemployed"))
loan=10000;
else
loan=15000;
}
}
if((age>=26)&&(age<=40))
{ if ((job.equals("selfemployed"))||
(job.equals("professional")))
if(asset>40000)
{ if(gender=='M')
loan=25000;
else
loan=30000;
}
}
if((age>=41)&&(age<=60))
{ if ((job.equals("selfemployed"))||
(job.equals("professional")))
if(gender=='M' || gender=='F')
if(asset>40000)
loan=40000;
}
if(age>60)
{ if(gender=='M' || gender=='F')
if(asset>25000)
if(job.equals("selfemployed"))
loan=35000-age*100;
else
loan=25000-age*100;
}