0% found this document useful (0 votes)
4 views3 pages

Chapter 5 Input in Java Program

The document outlines a series of programming tasks in Java, ranging from simple input/output operations to more complex calculations involving interest, salary, and discounts. Each task requires the implementation of specific functionalities such as greeting the user, converting time, calculating interest, and handling employee salary details. The tasks are designed to enhance programming skills and understanding of Java concepts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Chapter 5 Input in Java Program

The document outlines a series of programming tasks in Java, ranging from simple input/output operations to more complex calculations involving interest, salary, and discounts. Each task requires the implementation of specific functionalities such as greeting the user, converting time, calculating interest, and handling employee salary details. The tasks are designed to enhance programming skills and understanding of Java concepts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

STD-IX

PROGRAM SERIES-3

1. Write a program to take your name as input from user through keyboard and display a greeting
2. Write a program to read a time in minutes and split it into days, hours and minutes
3. Write a program that inputs principal amount, rate of interest and time and calculates compound interest.

4. Write a program display current date and time using the data class of the java. util package.
5. Write a program in java to input three integers and compute their average.
6. Write a program in java input two numbers using scanner class, also swap these two number without using
a third variable.
7. Write a program in java, using the scanner methods, to read and display the following details.
Name-As a string data type.
Roll number- As an integer data type.
Mark percentage -As a float data type.
8. Write a program in java that uses input initialisation to calculate the simple interest and the total amount the
given values
Principle amount= Rs 20000
Rate-8.9%
Time-3 years.
9. Write a program in java that accepts the seconds as input and converts them into the corresponding number
of hours, minutes and seconds. A simple output is shown below
Enter the total seconds: 5000
1hour 23 minutes 20 seconds.
10. Write a program in java to input the temperature in Fahrenheit, covert it into Celsius and display the value
in the terminal window.
11. Write a program to print number that is provided by the user.
12. Write a program to find the sum of two numbers
13. Write a program to find difference of two numbers
14. Write a program to find quotient of two numbers
15. Write a program to find product of two numbers
16. Write a program to find the first letter of your name by using charAt()
17. Create a project in Java to input time in minutes and display it into days, hours and minutes
18. Create a project in Java to accept side of a square and display its area and perimeter
19. Create a project in Java to accept the name, gender and basic pay of an employee. Calculate the
allowances/deductions as given below.
Dearness Allowance (DA) 25% of Basic pay
House Rent Allowance (HRA) 50% of Basic pay
Provident Fund (PF) 10% of Basic pay
Calculate and display the Gross pay and Net pay of the employee using the following formula
Gross pay = Basic pay + DA + HRA
Net pay = Gross pay - PF
20. A shopkeeper offers 10% discount on the MRP of all goods and charges 4% GST on the remaining amount.
Create a project in Java to calculate the amount to be paid by the customer by accepting item name and
MRP as inputs from the user. Display the item name, MRP, discount amount, GST amount and net paid
amount.
21. Write a program in Java to input the time in milliseconds and convert it into hours, minutes and seconds
22. Write a program to input two numbers and display them after swapping their values in the variables
23. Write a program in Java to find and display the sum and average three numbers by using function argument
24. Write a program in Java to find and display the simple interest and amount by using the function argument
when principal, interest and time are input from the console.
25. Write a program in java to find and display the area and perimeter of a right angled triangle by using
function argument. Take perpendicular and base as inputs from the console
26. Write a program to input a three digit number and display all the digits by using arithmetical operators
Example: 472
Output: 4
7
2
27. In a class of n number of students, the number of girls is m. Write a program to input the values of n and m.
Find and display the percentage of boys and girls in the class.
28. Write a program to accept the diagonal of a square. Find and display the area and perimeter.
29. Write a program to accept the number of days and display it after converting into number of years, months
and days.
30. An employee contributes 12% of salary to the provident fund. Of the remaining salary, he spends 10% on
house rent and 20% on education of the children. Write a program to input salary and calculate
The amount deducted as provident fund
The amount spent on rent and education
Write a program to input two numbers. Display the numbers after swapping them by using a third variable
31. Write a program to input the name and basic salary of an employee. Calculate and display the gross salary
and net salary when
DA = 30% of basic
HRA = 12.5% of basic
PF = 10% of basic
Gross = basic+DA+HRA
Net pay = Gross – PF
32. Write a program to display three rational numbers between any two consecutive natural numbers, taking
inputs from the console
Sample Input : 7 and 8
Sample Output: 7.25, 7.5, 7.75
Hint: Rational number between m and n can be calculated as (m+n)/2
33. A two digit number can be obtained by using the expression (10a+b), where a and b are the ten’s and unit’s
digits respectively. The number after reversing the digits will be (10b+a). Write a program to input two
digits of a number (a and b) and display the result when the sum of number and the reversed number is
divided by the difference between its digits.
Sample Input: 62
Sample Output: 22
34. The time period of a simple pendulum is given by the formula
l
T =2 π
g
Write a program to calculate and display the time period of a simple pendulum by taking length (l) and
acceleration due to gravity (g) as inputs.
35. Write a program by using class “Employee” to accept Basic pay of an employee. Calculate the
allowances/deductions as given below. Finally find and display the Gross and Net pay
Allowance/Deduction Rate ICSE 2005
DA 30% of basic
HRA 15% of basic
PF 12.5% of basic
Gross pay = Basic pay +DA+HRA
Net pay = Gross pay – PF
36. A shopkeeper offers 10% discount on the printed price of a digital camera. However, a customer has to pay
6% GST on the remaining amount. Write a program in Java to calculate and display the amount to be paid
by the customer taking printed price as an input.
37. A shopkeeper offers 30% discount on purchasing an article whereas the other shopkeeper offers two
successive discounts 20% and 10% for purchasing the same article. Write a program in Java to compute and
display the discounts. Take the price of an article as the input.
38. Mr. Agarwal invests certain sum at 5% per annum compound interest for three years. Write a program in
Java to calculate and display:
a) the interest for the first year
b) the interest for the second year
c) the interest for the third year
Take the sum as an input from the user
39. A business man wishes to accumulate 3000 shares of a company. However, he already has some shares of
that company valuing 10 (nominal value) which yields 10% dividend per annum and receives 2000 as
dividend at the end of the year. Write a program in Java to calculate and display the number of shares he has
and to calculate how many more shares have to be purchased to meet his target.
Annual dividend∗100
Hint: No. of share =
Nominal value∗¿ %
40. Write a program to input the time in seconds. Display the time after converting them into hours, minutes
and seconds.
41. Write a program to input two unequal numbers. Display the numbers after swapping their values in the
variables without using a third variable.
42. A certain sum is invested at the rate of 10% per annum for 3 years. Write a program to find and display the
difference between compound interest and simple interest. Take the sum as an input
Hint: SI = P*R*T/100 A=P*(1+R/100)T and CI = A-P
43. 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 and display his total cost price of the calculators by taking their selling
price as input.

( ) ( )
SP SP
CP= when profit CP= when loss
Hint: profit , loss
1+ 1+
100 100

You might also like