Pankaj
Pankaj
A shopkeeper offers 10% discount on the printed price of a mobile phone. However,
a customer has to pay 9% GST 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.util.*;
int mp;
double dis=0.00,gst=0.00,cm=0.00,ra=0.00;
mp=xx.nextInt();
dis=(double)mp*10/100;
ra=(double)mp-dis;
gst=(double)ra*9/100;
cm=ra+gst;
}
Question 2
A man spends (1/2) of his salary on food, (1/15) on rent, (1/10) on miscellaneous. Rest of the
salary is his saving. Write a program to calculate and display the following:
4. moneysaved
import java.util.*;
int s;
double f,r,m,sv;
s=xx.nextInt();
f=(double).5*s;
r=(double).067*s;
m=(double).1*s;
sv=(double)s-(f+r+m);
}
Question 3
Write a program to input time in seconds. Display the time after converting them into hours,
import java.util.*;
int s,rs,m1,h,m;
s=xx.nextInt();
m1=s/60;
rs=s%60;
h=m1/60;
m=m1%60;
}
Question 4
Write a program to input two unequal numbers. Display the numbers after swapping their
import java.util.*;
int a,b;
a=xx.nextInt();
b=xx.nextInt();
a=a*b;
b=a/b;
a=a/b;
}
Question 5
A certain amount of money is invested for 3 years at the rate of 6%, 8% and 10% per annum
import java.util.*;
double p;
double a1=0.00,a2=0.00,a3=0.00,ci=0.00;
p=xx.nextDouble();
a1=p*106/100;
a2=a1*108/100;
a3=a2*110/100;
ci=a3-p;