Practical Assignment For Class IX 2022

Practical Assignment

Class IX 

2022

1.       Write a Java program to calculate the area of a rectangle. (Area = length * breadth Given length = 5, and breadth = 4)

2.       Write a Java program to calculate the volume of a cylinder. (Volume = πr2h Given r= 5.5, h= 6.5)

3.       Write a program in Java to find the area, perimeter, and diagonal of a square and display the output of the program. (Given: side of a square = 25).

4.       Write a program in Java 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

5.       Write a program in Java to input two numbers. Display the numbers after swapping them by using a third variable.

Sample Input: a= 95, b=45

Sample Output: a=45, b-95

6.       The time period of a Simple Pendulum is given by the formula: T = 2π  

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. [π=22/7]

7.       Write a program in Java to calculate and display the value of the given expression:

Take the value of a, b, and c as inputs.

8.       Write a Java program to input a number from the user and check and display whether it is an even number or odd.

9.       Write a Java program to input a number from the user and check and display whether it is a BUZZ number or not.

10.    In an examination, the grades are awarded to the students in 'Science" according to the average marks obtained in the examination.

Marks

Grades

80% and above

Distinction

60% or more but less than 80%

First Division

45% or more but less than 60%

Second Division

40% or more but less than 45%

Pass

Less than 40%

Promotion not granted


               

 


Write a to input name and marks in Physics, Chemistry and Biology. Calculate the average marks. Display the name, average marks, and the grade obtained.

11.    A cloth showroom has announced festival discounts and gifts on the purchase of items, based on the total cost as given below:

Total Cost                            Discount                                Gift

Up to 2,000                           5%                                          Calculator

2,001 to 5000                       10%                                        School Bag

5,001 to 10,000                    15%                                        Wall Clock

Above 10,000                      20%                                        Wrist Watch

Write a program to input the total cost. Compute and display the amount to be paid by the customer along with the gift.

12.    Write a program to accept two angles. Calculate and display whether they are 'Complementary Angles' or 'Supplementary Angles' as per the user's choice. [Hint: Enter 'c' for complementary or 's' for supplementary]

13.    Write a program to accept the length and breadth of a rectangle. Calculate and display the area, perimeter or diagonal of the rectangle as per the user's choice. (Hint use switch case)

14.    Write a Java program to accept a number from the user and display the ‘factorial’ of the number entered by the user.

15.    Write a Java program to input a number from the user and check and display whether it is a ‘Prime number’ or not.

16.    Write a program to accept a number and check whether it is a Spy Number or not. (A number is a spy if the sum of its digits equals the product of its digits.)

Sample Input: 1124

Sum of the digits=1+1+2+4=8          Product of the digits = 1*1*2*4 = 8

17.    A Special two-digit number is such that when the sum of its digits is added to the product of its digits, the result is equal to the original two-digit number.

Example: Consider the number 59.

Sum of digits=5+9=14        Product of digits=59 450  

Sum of the sum of digits and product of digits 14+45=59

Write a program to accept a two-digit number. Add the sum of its digits to the product of its digits. If the value is equal to the number input, then display the message "Special 2-digit number" otherwise, display the message "Not a special two-digit number".

18.    Write a program to input a number. Check and display whether it is a ‘Niven number’ or not. (A number is said to be Niven when it is divisible by the sum of its digits).

Sample Input: 126 Sum of its digits=1+2+6=9 and 126 is divisible by 9.

19.    Write a Java program to display the first ten terms of the ‘Fibonacci series’.

20.    Write a Java program to display the first ten terms of the series 1, 4, 9, 16, …… .

21.    Write a program to display the 'Abundant numbers’ from 10 to 100. An 'Abundant' number is a number for which the sum of its proper divisors (excluding the number itself) is greater than the number itself.

For example: take a number (say, 12)

Factors of 12= 1, 2, 3, 4, 6                 Sum of factors= 1+2+3+4+6= 16

Since, 16>12, thus, 12 is an Abundant number. The first few abundant numbers are 12, 18, 20, 24, 30, 36, 40,

22.    Write a program in Java to display the given pattern.

1

12

123

1234

12345

23.    Write a program in Java to display the given pattern.

54321

4321

321

21

1

24.    Write a program to display the given pattern.

1

10

101

1010

10101

25.    Write a program in Java to display the given pattern.

*

* *

* * *

* * * *

* * * * *

(Note: Practical Assignment questions are also available on https://javaprogramcode.blogspot.com)

No comments: