0% found this document useful (0 votes)
5 views1 page

Assignment 2

Uploaded by

mayuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Assignment 2

Uploaded by

mayuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ASSIGNMENT 2

Write Java programs:


1.
The volume of a cuboid, cylinder and cone can be calculated by the formula:
1. Volume of a Cuboid (v=l * b * h)
2. Volume of a c Cylinder (v=π * r2 * h)
3. Volume of a Cone (v= 1/3 * π * r2 * h)

Write a menu driven (switch case) program to find the volume of these solids by
taking suitable variables and data types. Display the output with proper messages.

2. Write a program to enter any number of user’s choice and check whether the
given number is:
a) Divisible by 11
b) Divisible by 3 and 5
c) Divisible by 7
3 . Write a program to input a number and check if it is a single digit, double digit,
or a three digit number. Display the output with proper messages.

4. A Digital Shoppe announces seasonal discount on the laptops based on the


table given below. Accept the cost of laptop as input, calculate and print the
discount amount.

Cost of laptop Discount

Rs. 30000 - Rs.40000 10%

Rs. 40001 - Rs. 50000 15%


Rs. 50001 or more 18%

5.
Write a program to show a menu to the user on output screen as follows:
1. Enter 1 to find Area of a Circle.
2. Enter 2 to find Diagonal of Square.
3. Enter 3 to find Area of a Square.
Find the area of a circle if user enters 1, diagonal of a square if user enters 2,
and area of a square if user enters 3.
Area of a circle = π r2
Diagonal of a square = √𝟐 𝒂, where a is the side of the square
Area of a square = a2 ,where a is the side of the square

*****************

You might also like