7. A bank announces new rates for Term Deposit Schemes for their customers and Senior
Citizens as given below:
Term
Rate of Interest (General)
Rate of Interest (Senior Citizen)
7.5%
8.0%
8.5%
9.0%
Up to 1 year
Up to 2 years
Up to 3 years
More than 3 years
10.0%
9.5%
10.0%
11.0%
The 'senior citizen' rates are applicable to the customers whose age is 60 years or more.
Write a program to accept the sum (p) in term deposit scheme, age of the customer
and the term. The program displays the information in the following format:
Amount Deposited
Interest earned
Amount Paid
Term
xxx
Age
xxx
XXX
XXX
XXX
Answers
Biggest Of Three Numbers Using Conditional operator/Ternary Operator in C
# include <stdio.h>
void main()
{
int a, b, c, big ;
printf("Enter three numbers : ") ;
scanf("%d %d %d", &a, &b, &c) ;
big = a > b ? ( a > c ? a : c) : (b > c ? b : c) ;
printf("\nThe biggest number is : %d", big)
Answer:
import java.util.Scanner;
public class HelloWorld{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
double sum,i;
int term,age;
System.out.println("Enter amount deposited");
sum=sc.nextFloat();
System.out.println("Enter term period of deposit scheme in years");
term=sc.nextInt();
System.out.println("Enter your age");
age=sc.nextInt();
if(age<60)
{
if(term<=1)
i=(term*sum*7.5)/100;
else if(term<=2)
i=(term*sum*8)/100;
else if(term<=3)
i=(term*sum*8.5)/100;
else
i=(term*sum*9)/100;
}
else
{
if(term<=1)
i=(term*sum*10)/100;
else if(term<=2)
i=(term*sum*9.5)/100;
else if(term<=3)
i=(term*sum*10)/100;
else
i=(term*sum*11)/100;
}
System.out.println("Amount Deposited Interest earned Amount paid Term Age");
System.out.println(" "+sum+" "+i+" "+(i+sum)+" "+term+" "+age);
}
}
Explanation:
Hope it helps :-)