Question: jGRASP B01 - Triangles You will write a program that will ask the user for the Cartesian coordinates of three points that make up a
jGRASP
B01 - Triangles You will write a program that will ask the user for the Cartesian coordinates of three points that make up a triangle, and based on these points, the program will print whether the triangle is equilateral, isosceles or scalene. Your program needs to do the following:
1. Ask the user for the x and y coordinates of the three points (these will be decimal numbers)
2. Based on these points, your program needs to compute the distance between those points and print the type of the triangle. You can compute the distance between two points with the following formula:
In the previous formula, (x2, y2) are the coordinates of one point, and (x1, y1) are the coordinates of the other point.
The different types or triangles are:
Equilateral: All three sides are equal in length.
Isosceles: Two of the three sides are equal in length.
Scalene: All three sides are different in length.
B02 - Hurricane Category Estimator You will write a program that, depending on the trend in wind speed, it will compute the type of hurricane if that trend follows.
Your program will do the following:
1. Ask the user for the current wind speed in mph.
2. Ask the user for yesterday's wind speed in mph.
3. Assume the amount increased or decreased in the wind speed will continue and compute the wind speed for tomorrow, and print the category of the hurricane.
The following are the hurricane types according to the wind speed.
| Type | Wind speed in mph |
| Tropical Storm | 39-73 |
| Category 1 | 74-95 |
| Category 2 | 96-110 |
| Category 3 | 111-130 |
| Category 4 | 131-155 |
| Category 5 | 156 mph and up |
B03 - Electricity Bill Calculator You will write a program that will calculate the electricity bill of the user.
Your program will ask the user for the amount of electricity he/she consumes normally during:
During the day on a normal week day.
During the night on a normal week day.
During the day on a normal weekend day.
During the night on a normal weekend day.
The user will enter these values in kWh (kilowatt hour). Assume the month has 30 days and 5 weekends (that is, 10 weekend days and 20 week days). Based on this assumption and the amount of electricity consumed by the user, compute the total electricity bill with the following prices:
$2.50 per kWh during the day on normal week days.
$1.25 per kWh during the night on normal week days.
$2.00 per kWh during the day on weekend days.
$1.00 per kWh during the night on weekend days.
Your program needs to add a tax of 20% to the final amount. Your program will print the total before tax, the amount of tax and the final electricity bill with tax included.
B04 - Enrollment Write a program that will accept or deny a student's enrollment in a class based on the amount of available seats and the grades he/she received in the prerequisite courses.
Your program will ask the student for the grades obtained in calculus, algebra, physics and statistics. Your program will also ask how many available seats are in the class he/she wants to enroll in. If the user enters an invalid value for any of these inputs (that is, a negative value for the grades or available seats, an amount of available seats greater than 50, or a grade greater than 100) you need to print an error statement saying that the input is not valid and finish the program.
If the inputs are valid, your program will either accept or deny the enrollment based on the following rules:
If the amount of available seats is greater than or equal to 15:
The user needs to have the following grades: physics > 65 and calculus >= 70 and statistics > 75
Or, the user needs to have the following grades: algebra >= 90 and calculus >= 85
Otherwise, the user needs to have all those grades >= 80 in order to be enrolled.
Your program needs to print whether the user was successfully enrolled, or if the enrollment was rejected.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
