Question: Question 1 : By using java coding part A Write a program that prompts the user for the quiz marks of three students: Ahmed, Ali,
Question 1: By using java coding
part A
Write a program that prompts the user for the quiz marks of three students: Ahmed, Ali, and Ayman. The mark should be a non-negative integer less than or equal to 10 (assume integer data type for user inputs). The program should first check that the numbers entered by the user are valid. If any of the numbers is invalid, the program should display a message and exit. Otherwise, the program should rank the students in terms of their marks listing the student with the highest mark first. Consider the following sample outputs for two runs (bold font represents user input):
Please enter the quiz mark for Ahmed: 4
Please enter the quiz mark for Ali: 10
Please enter the quiz mark for Ayman: 6
Ali, Ayman, Ahmed
____
Please enter the quiz mark for Ahmed: 40
Please enter the quiz mark for Ali: 10
Please enter the quiz mark for Ayman: 6
All entered numbers should be non-negative integers less than or equal to 10.
Part B
Write a program that calculates the area of several types of shapes. The program first prompts the user for the desired shape:
Square.
Rectangle.
Triangle.
Circle.
Trapezoid.
Then, the program collects the required dimensions. For example, the length and width of a rectangle needs to be collected to calculate its area. Assume that all dimensions are double. Use the following formulas for computing the areas:
Area of a Rectangle = Base * Height
Area of a Square = Side_length * Side_length
Area of a Triangle = 0.5 * (Base Height)
Area of a Circle = 3.141592654 * (radius * radius)
Area of a Trapezoid = 0.5 * (Base1 + Base2) * Height
For example, consider the following sample output (bold font represents user input):
Please choose a shape:
Square
Rectangle
Triangle
Circle
Trapezoid
3
Please enter the triangles base: 3
Please enter the triangles height: 5
The triangles area is 7.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
