Computer annual rev
Computer annual rev
MALLAPUR CAMPUS
ANNUAL REVISION
1) Write a program to accept a integer and check whether it is perfect square or not
1. Ex: 25 sqrt=5.0 it is a perfect square
2. Ex : 3 sqrt=1.713 it is not a perfect square
2) Write a program to accept P, T and R values, find simple interest and compound interest and find their
difference.
SI S.I. = (Principal × Rate × Time)/100
3) The daily wages paid to a worker is rs 60/day.he works 3 days in the first week , 5 days in the second
week, 2 days in the third week and 7 days in the fourth week. Write a program to compute and
payment he gets in this month
4) Write a program , to convert a given temperature from Fahrenheit to Celsius (c = 5/9*(f-32)) and
Celsius to Fahrenheit (f = 1.8*c +32) (Accept appropriate values wherever required)
5) The distance between two electric poles is accepted in meters, calculate and print the distance in
kilometer and meter
6) Without using if-else statement and ternary operators, accept three unequal numbers and display the
second smallest number. [Hint: Use Math.max( ) and Math.min( )]
Sample Input: 34, 82, 61
Sample Output: 61
7) Write a program to calculate the final salary after increment. Salary increment of employees based
on their basic pay.
8) Write a program to input a character . Convert the character into its opposite case .Print the original
and converted character.
Eg: input : G
Output : G g
9) Write a program to accept an alphabet and print its next five characters using a for() loop.
10) Define a method swap() which takes 2 character type arguments ch1 and ch2 interchange the values
of ch1 and ch2 . Print the values of ch1 and ch2 before and after interchange
Ex ch1 : B
ch2 : R
After interchange ch1 : R
ch 2 : B
11) Write a program to input three angles of a triangle and check whether a triangle is possible or not. If
possible then check whether it is an acute-angled triangle, right-angled or an obtuse-angled triangle
otherwise, display 'Triangle not possible'.
Sample Input: Enter three angles: 40, 50, 90
Sample Output: Right=angled Triangle
12) An institution has decided to admit new candidates in different streams on the following criteria
TOTAL MARKS OBTAINED STREAM OFFERED
13) Write a program to input the prize of the product and quantity purchased . calculate the total cost and
discount on total cost as per the given criteria.
TOTAL COST DISCOUNT
₹ 10000.00 5.5%
₹15000.00 7.5%
14) Mr. Kumar is an LIC agent. He offers a discount to his policy holders on the annual premium.
class name: Policyholder
Data Members:
name - to accept customer name
sum - to accept the sum assured
disc- to calculate discount
Member methods:
Input() - name(String), sum(double)
Calculate- find the discount amount based on the following criteria
Sum Assured Discount
Up to ₹ 1,00,000 5%
15) Create a mini calculator. Enter two numbers ( a, b). Enter a choice ( ch). Perform add, subtract,
multiply and divide upon the value of choice being + , - , * , / .Use switch..case statement.
16) Write a program to accept the weight. Calculate the charge of a transport company according to the
following criteria:
Weight Rate
first 100 Kg Rs. 10/Kg
For the next 50 Kg Rs. 7/Kg
Above 150 Kg Rs. 5/kg
Display the details in the following format:
Weight Total cost
_______ _________
17) The volume of solids, cuboid, cylinder and cone can be calculated by the Formula:
a) Volume of a cuboid: (v = l × b × h)
b) Volume of a cylinder: (v = π× r²× h)
c) Volume of a cone: (v = 1/3× π × r²× h) (π = 22/7)
Using a switch case statement, write a menu driven program to find the volume of different
solids by taking suitable variables and data types.
18) Write a program to accept a number and check and display whether it is a spy number or not. (A
number is spy if the sum of its digits equals the product of its digits.)
Example : consider the number 1124,
Sum of the digits = l + l+ 2 + 4 = 8
Product of the digits = 1×1 x2x4 = 8
19) Write a Java program to check whether the entered number is a composite number or not? (Hint:
Composite numbers are having more than 2 factors)
20) Write a program to accept 25 characters using for() loop. Find and Print the following counters.
i) Number of Uppercase characters
ii) Number of Lowercase characters
iii) Number of Other characters
21) Write a program to input a number and check if it is a Nest number or not
Hint : A number is said to be a ‘Nest Number’ if the number contains at least one digit which is zero.”
Eg 1 Input : 2008 Output : It is a Nest Number
Eg 2 Input : 238 Output : Not a Nest Number
22) Write a program to accept any 20 numbers and display only those numbers which are prime.
Hint: A number is said to be prime if it is only divisible by 1 and the number itself.
23) Using a switch case write a menu driven program to print the following
1. PATTERN:
11111
3333
555
77
9
a) 1 b) F E D C B A
10 FEDCB
101 FEDC
1010 FED
10101 FE
F