This TMA consists of a Computational Geometry project. You must submit your source files well commented in a Java project. Also, you must submit a single word file containing:
- – A copy and paste of all java code.
- – Snapshots of different program runs.
- – If your code does not completely work, attach some description to explain the status of the code and theruns.You have two submission links on your LMS page:
- The regular submission link to upload a zipped folder of your Java project.
- The regular submission link to upload the word file.Your TMA will not be marked if not all the required files are submitted on both submission links.Plagiarism Warning:As per AOU rules and regulations, all students are required to submit their own TMA work and avoid plagiarism. The AOU has implemented sophisticated techniques for plagiarism detection. You must provide all references in case you use and quote another person’s work in your TMA. You will be penalized for any act of plagiarism as per the AOU’s rules and regulations.Declaration of No Plagiarism by Student (to be signed and submitted by student with TMA work):I hereby declare that this submitted TMA work is a result of my own efforts and I have not plagiarized any other person’s work. I have provided all references of information that I have used and quoted in my TMA work.Name of Student: Signature:
Date:
This TMA requires an implementation of a java project using the material covered in the first 4 lectures ONLY and
any using of programming tools rather than the first 4 meetings will not be considered.
OVERVIEW
This TMA requires an implementation of a java project using the material covered in the first 4 lectures ONLY. Any using of programming tools rather than the first 4 meetings will not be considered.
The requested project is dealing with some analysis of 2D geometric shapes. The considered 2D shapes are: Square, Rectangle,Triangle, Parallelogram and Circle. As you know, each one of these shapes has special geometric characteristics and attributes. For example, square area and perimeter are computed based on the square side, while parallelogram area and perimeter are computed based on the length of parallelogram sides and the angle between the sides of the parallelogram…
- Implement a Java program that reads from the user inputs of as set of shapes (minimum 20 shape) such that for each of the above 5 shapes, minimum 3 input shapes are entered, (i.e., your inputs should include at least 3 squares, 3 rectangles, 3 triangles, 3 parallelograms and 3 circles.)
- The program then computes the area and perimeter of each input shapes based on its input attributes.
- The program should print the average area and average perimeter of the entered shapes.
- Finally, the program should print the shape type with maximum area (and its attributes) and the shape type withminimum perimeter (and its attributes.)
- The program should works EXACTLY as given sample run
- For triangle shapes, you have to apply the triangle inequality to assure that the entered 3 triangle sides are forminga real triangle and if not, an error message should be presented.
- If the entered shape is not one of the considered 5, an error message should be presented.Sample Run:==========Rest shapes to be entered: (total shapes: 20, square: 3, Triangle: 3, Rectangle: 3, Parallelogram: 3 and Circle: 3)
Enter shape type (Square, Rectangle, Triangle, Parallelogram, Circle) or STOP to end: circle
Enter circle radius: 4Circle number 1 area = 50.27 Circle number 1 Perimeter = 25.13Rest shapes to be entered: (total shapes: 19, square: 3, Triangle: 3, Rectangle: 3, Parallelogram: 3 and Circle: 2)
Enter shape type (Square, Rectangle, Triangle, Parallelogram, Circle) or STOP to end: square
Enter square side length: 6Square number 1 area = 36.00 Square number 1 Perimeter = 24.00Rest shapes to be entered: (total shapes: 18, square: 2, Triangle: 3, Rectangle: 3, Parallelogram: 3 and Circle: 2)
Enter shape type (Square, Rectangle, Triangle, Parallelogram, Circle) or STOP to end: rectangle Enter rectangle length: 6Enter rectangle width: 8
Rectangle number 1 area = 48.00 Rectangle number 1 Perimeter = 28.00
TM105 TMA KSA – Fall 2020-2021 2
Rest shapes to be entered: (total shapes: 17, square: 2, Triangle: 3, Rectangle: 2, Parallelogram: 3 and Circle: 2)
Enter shape type (Square, Rectangle, Triangle, Parallelogram, Circle) or STOP to end: circle
Enter circle radius: 12
Circle number 2 area = 452.39 Circle number 2 Perimeter = 75.40
Rest shapes to be entered: (total shapes: 16, square: 2, Triangle: 3, Rectangle: 2, Parallelogram: 3 and Circle: 1)
Enter shape type (Square, Rectangle, Triangle, Parallelogram, Circle) or STOP to end: square
Enter square side length: 15
Square number 2 area = 225.00 Square number 2 Perimeter = 60.00
Rest shapes to be entered: (total shapes: 15, square: 1, Triangle: 3, Rectangle: 2, Parallelogram: 3 and Circle: 1)
Enter shape type (Square, Rectangle, Triangle, Parallelogram, Circle) or STOP to end: parallelogram Enter parallelogram side 1 length: 12
Enter parallelogram side 2 length: 5
Enter parallelogram angle between the 2 sides: 30 Parallelogram number 1 area = 30.00 Parallelogram number 1 Perimeter = 34.00
Rest shapes to be entered: (total shapes: 14, square: 1, Triangle: 3, Rectangle: 2, Parallelogram: 2 and Circle: 1)
Enter shape type (Square, Rectangle, Triangle, Parallelogram, Circle) or STOP to end: triangle Enter triangle side 1 length: 3
Enter triangle side 2 length: 6 Enter triangle side 3 length: 8 Triangle number 1 area = 7.64 Triangle number 1 Perimeter = 17.00
.
.
.
Rest shapes to be entered: (total shapes: 0, square: 0, Triangle: 0, Rectangle: 0, Parallelogram: 0 and Circle: 0)
Enter shape type (Square, Rectangle, Triangle, Parallelogram, Circle) or STOP to end: stop
Program Statistics >>
Number of entered shapes is 21 with the following distribution
Shape Number Square 6 Rectangle 3 Triangle 4 Parallelogram 3 Circle 5
% Ratio 28.57 14.29 19.05 14.29 23.81
Average area of the entered shapes is 190.82
Average perimeter of the entered shapes is 47.12
Maximum area is 1134.11 of a shape type CIRCLE with radius length 19.00 Minimum perimeter is 12.00 of a shape type SQUARE with side length 3.00 ———


0 comments