Asm 249425
Asm 249425
1. Write a program using variables to find the profit and profit percent of a certain transaction where S.P.=₹ 10000
and C.P.=₹ 7000.
class Profit
{
static void main()
{
float sp=10000,cp=7000,p,pp;
p=sp-cp;
pp=p/cp*100;
System.out.println("Profit="+p);
System.out.println("Profit Percent="+pp);
}
}
Output
2.Write a program to initialize two integer variables a and b with 5 and 6 respectively and interchange them. Thus
after interchanging, a and b will be 6 and 5 respectively.
class Swap
{
static void main()
{
int a=5,b=6,t;
t=a;
a=b;
b=t;
System.out.println(a+" "+b);
}
}
Output
3.You want to display your bio-data on the output screen. Write a program in Java to perform the task in the given
format:
Name:
Father's Name:
Date of birth:
Blood Group:
Aadhar Card No.:
State:
class BioData {
public static void main() {
System.out.println("Name: Tiffany Holland");
System.out.println("Father's Name:Tom Holland");
System.out.println("Date of birth: 12/12/2005");
System.out.println("Blood Group: O+");
System.out.println("Aadhar Card No.: 4321 8756 9978");
System.out.println("State: West Bengal");
}
}
Output
4.A businessman wishes to accumulate 3000 shares of a company. However, he already has some shares of that
company valuing ₹10 (nominal value) which yield 10% dividend per annum and receive ₹2000 as dividend at the end
of the year. Write a program in Java to calculate the number of shares he has and how many more shares to be
purchased to make his target.
Hint: No. of share = (Annual dividend * 100) / (Nominal value * div%)
6.Write a program to calculate the distance of 1506 feet in terms of yards and miles.
Given Fixed values are 1 mile=1760 yards and 1 yard=3 feet.
7.Write a program to calculate tax for a taxable income of Rs.3,10,000, if tax rate is fixed at 2.2%.
8.Write a program that computes tax for income of Rs.12,23,423.The income upto Rs 30,0000 is not taxable and the
tax is computed as 15% of the taxable income.