Sequential Programming in Java
1. Write a program to print, "Welcome to the World of Computers".
2. Write a program to print your Name, Class, Roll_No, Marks and Age.
Name this class, `MyProfile'.
3. Write a program to print your School name four times in separate lines.
4. Write a program to find the sum and average of three numbers.
5. Write a program to calculate the tax for a taxable income of Rs.
4,10,000, if the tax rate is fixed at 3.2%.
6. Create a program that will generate a bill at McDonald's for four
vegetable burgers (@ Rs 45 per vegetable Burger) and three vegetable
McPuffs (@ Rs 25 per vegetable McPuff). There is a special
Independence Day discount of Rs 50 on the final bill amount.
7. Write a program to input two unequal numbers. Display the numbers
after swapping their values in the variables without using a third
variable.
8. Write a program to input two unequal numbers. Display the numbers
after swapping their values in the variables using a third variable.
9. A certain amount is invested at the rate 10% per annum for 3 years.
Find the difference between Compound Interest (CI) and Simple
Interest (SI). Write a program to take amount as an input.
Hint:
SI = (P * R * T) / 100
A = P * (1 + (R/100))T
CI = A - P
10. A shopkeeper sells two calculators for the same price. He earns 20%
profit on one and suffers a loss of 20% on the other. Write a program
to find his total cost price of the calculators by taking selling price as
input.
Hint:
CP = (SP / (1 + (profit / 100))) (when profit)
CP = (SP / (1 - (loss / 100))) (when loss)
11. 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 %)
12. Write a program to input the time in seconds. Display the time after
converting them into hours, minutes and seconds.
Sample Input: Time in seconds 5420
Sample Output: 1 Hour 30 Minutes 20 Seconds
13. Write a program by using class 'Employee' to accept Basic Pay of an
employee. Calculate the allowances/deductions as given below.
Allowance / Deduction Rate Dearness Allowance (DA) 30% of Basic Pay
House Rent Allowance (HRA) 15% of Basic Pay Provident Fund (PF)
12.5% of Basic Pay Finally, find and print the Gross and Net pay.
Gross Pay = Basic Pay + Dearness Allowance + House Rent Allowance
Net Pay = Gross Pay - Provident Fund