Question: Question C 3 [ 1 0 marks ] Write your answer in the provided file A 3 Q 3 . py . Fill in your

Question C3[10 marks]
Write your answer in the provided file A3Q3. py. Fill in your name and student ID in the designated section.
Write a program based on the specifications below:
1. Define a Python Class based on the given simplified UML diagram and then given requirements:
```
Triangle
side1
side2
side3
init__(side1=0, side2=0, side3=0)
_str__()
isAtriangle()
isRightAngleTriangle()
area()
```
a. The constructor accepts three arguments for assigning related fields and define the data fields, properly assigning the input parameters accordingly.
b. The method __str__() returns a string representation of the object in the format shown in sample outputs.
c. The method isAtriangle() accepts no argument and returns True if the three input sides can form a triangle; returns False otherwise.
d. The method isRightAngleTriangle() accepts no argument and returns True if the triangle is a right-angle triangle; returns False otherwise.
e. The method area () accepts no argument, calculates the area of a triangle, and returns it.
2. Write a function isSimilarTriangles () to compare two triangles.
The function accepts two Triangle objects as input parameters and returns True if they are similar triangles; returns False otherwise.
3. Write a function main() which continuously asks user to input 6 values: (side1a, side2a, side3a) and (side1b, side2b, side3b) for the Triangle object T1 and T2 respectively. Formulate two triangles and continue the process until T1 and T2 are either similar triangles \(\mathbf{O R}\) either one is a right-angle triangle.
a. Exit the program when the triangles are similar triangles, or either one is a right-angle triangle. When both criteria are satisfied, display for similar triangles should be prioritized.
b. If no two triangles are formed, display a message asking the user to reinitiate both triangles.
c. If the triangles are neither similar triangles nor none of them is a right-angle triangle, display a message asking the user to reinitiate both triangles.
d. You can assume that the user will only input valid numeric values.
4. Call the main() to start to program execution.
Hint: Refer to the general guidelines to determine how to call the main () function.
The program output should adhere to the Sample Program Output provided below: Sample Output 1:
```
>> Enter side1a for the first side of a triangle: 1
>> Enter side2a for the second side of a triangle: 2
\gg Enter side3a for the third side of a triangle: 5
The 3 sides 1,2 and 5 cannot form a triangle.
>> Enter side1b for the first side of a triangle: 6
>> Enter side2b for the second side of a triangle: 4
>> Enter side3b for the third side of a triangle: 3
The 3 sides 6,4 and 3 can form a triangle with area 5.3327.
The two triangles are neither similar nor none of them being right angle triangle;
please re-enter another two triangles.
============================
==== This is a separator ====
============================
```
> Enter side1a for the first side of a triangle:
Note: In the last line of the Sample Output 1, the program is still waiting for user input.
Sample Output 2:
>> Enter side1a for the first side of a triangle: 5
>> Enter side2a for the second side of a triangle: 3
>> Enter side3a for the third side of a triangle: 4
The 3 sides 5,3 and 4 can form a triangle with area 6.0000.
> Enter side1b for the first side of a triangle: 3
>> Enter side2b for the second side of a triangle: 8
>> Enter side3b for the third side of a triangle: 6
The 3 sides 3,8 and 6 can form a triangle with area 7.6444.
At least one of the triangles are right angle triangle. Escape...!
Sample Output 3:
```
>> Enter sidela for the first side of a triangle: 6
>> Enter side2a for the second side of a triangle: 2
>> Enter side3a for the third side of a triangle: 5
```
The 3 sides 6,2 and 5 can form a triangle with area 4.6837.
> Enter side1b for the first side of a triangle: 1
>> Enter side2b for the second side of a triangle: 2.5
> Enter side3b for the third side of a triangle: 3
The 3 sides 1,2.5 and 3 can form a triangle with area 1.1709.
These two triangles are similar triangles. Escape...!
Note: The user inputs are in green.
- END OF PAPER -
Question C 3 [ 1 0 marks ] Write your answer in

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!