Computer Science, asked by alfiarsala345, 7 months ago

a) Write a program to enter item no, quality purchased and rate. Calculate the total
purchase price and print it with the gift. The gifts to the customers are given in the
following manner:
Amount of Purchase(RS) —
Gift
100and above but less than 500
a key ring
500 and above but less 1000
a leather purse
1000 and above
a pocket calculator​

Answers

Answered by divyasingh0264
0

Answer:

Mr. Shyam Lal Agarwal invests certain sum at 5% per annum compound interest for three years. Write a program in Java to calculate:

the interest for the first year

the interest for the second year

the amount after three years.

Take sum as an input from the user.

import java.io.*;

public class Q1

{

public static void main(String args[])throws IOException

{

InputStreamReader read =new InputStreamReader(System.in);

BufferedReader in =new BufferedReader(read);

int p; double SI1,SI2,SI3,A3;

System.out.println(“Enter the principal”);

p=Integer.parseInt(in.readLine());

SI1=(p*5.0*1)/100.0;

System.out.println(“Interest for the first year =”+SI1);

SI2=((p+SI1)*5.0*1)/100.0;

System.out.println(“Interest for the second year =”+SI2);

SI3=((SI1+SI2+p)*5.0*1)/100;

A3=SI1+SI2+SI3+p;

System.out.println(“Amount after three years =”+A3);

}

}

Sample Input: 10000

Sample Output: Interest for the first year =500.0

Interest for the second year =525.0

Amount after three years =11576.25

2.

A shopkeeper offers 10% discount on the printed price of a Digital Camera. However, a customer has to pay 6% sales tax on the remaining amount. Write a program in Java to calculate the amount to be paid by the customer, taking printed price as an input.

import java.io.*;

public class Q2

{

public static void main(String args[])throws IOException

{

InputStreamReader read =new

Similar questions