Week 3 Assignment
1) Write a program to find the area of a scalene triangle.
Hint: Use the formula A = √[s × (s – a) × (s – b) × (s – c)]
where, s= semiperimeter of a triangle,
a,b,c = three sides of a triangle
2) Write a java program to find the average of any three numbers.
3) Write a java program to find the area of four wall.
Hint: Use the formula A=2h(l+b)
4) Write a program to find the distance covered by a body
Hint: Use the formula (s=ut + 1/2 at^2])
5) Write a program to calculate the area and circumference of a
semicircle.
6) Write a program to find the square root and power 6 of a given
number using the Math function.
//Other questions on the next page.
Q7. Write the output of the following program.
Q8. Write the output of the following program.
Q9. Declare any two-integer variable and initialize with values also. Then check
whether the first variable is greater or not.
(Hints for output: First variable is greater: True
First variable is greater: False)
Q10. Write a Java program that reads a number in inches, converts it to
meters.
Note: One inch is 0.0254 meter.
Test Data
If the value in inches is 1000.
Expected Output :
1000.0 inch is 25.4 meters
Q11) Write in points what you have learnt in Week 3 other than slide contents.