Sale!

Lab Exercise 2 COMP 248

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (5 votes)

Question: Today you are commissioned to create a Java program that will prompt for and read three integers as three
internal angles of a triangle in degrees angle1, angle2 and angle3 entered by the user, and determine the category of the
triangle based on the three angles according to the specifications that follow. Note that one set of user input may belong
to more than one category. Be sure to use the same format and wording as in the sample runs in the tables below.
Using a series of compound if statements (no if/else or nested if required or needed) determine which condition(s) the 3
internal angles satisfy.
1. If any of the internal angles is equal to 90, display “This might be a right triangle!”.
2. If any of the internal angles is greater than 90, display “This might be an obtuse triangle!”.
3. If all the internal angles are smaller than 90, display “This might be an acute triangle!”.
4. If the sum of the three internal angles is not equal to 180, display “This turns out to be an invalid triangle!”.
5. Finish off with the message “Finished!”.
The box below illustrates how your program should behave and appear.
REMEMBER in the output: ◦ is a space and  is a new line. Text in green is user input
Entering◦three◦internal◦angles:◦90◦30◦60

This◦might◦be◦a◦right◦triangle! 
Finished!
Entering◦three◦internal◦angles:◦91◦90◦90

This◦might◦be◦a◦right◦triangle! 
This◦might◦be◦an◦obtuse◦triangle! 
This◦turns◦out◦to◦be◦an◦invalid◦triangle! 
Finished!
Entering◦three◦internal◦angles:◦40◦60◦80

This◦might◦be◦an◦acute◦triangle! 
Finished!
Note 1: You are to expect a perfect user who will always input three positive integers; that is, do not verify the
validity of user input.
Note 2: All calculations, inputs and outputs should be in integer format and the use of libraries other than
java.util.Scanner is prohibited. Your program must work for any double values entered, not just the ones in the
samples above.
Note 3: Final thought, remember that your solution is case-sensitive and space-sensitive, fulfill the above
instructions carefully and precisely.
Reminder:
When submitting your solution to the lab system, make sure that if you have a package statement at the
top of your .java file it is commented out (has // in front of it) as failing to do so will result in a grade of 0
(restriction of the DOMJudge system).