quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryهندسة الحاسبات schoolبكالوريوس event_available2026-07-15

السؤال

Transcribed Image Text:

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 with minimum 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 forming a 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: 4 Circle number 1 area = 50.27 Circle number 1 Perimeter = 25.13 Rest 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: 6 Square number 1 area = 36.00 Square number 1 Perimeter = 24.00 Rest 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: 6 Enter rectangle width: 8 Rectangle number 1 area = 48.00 Rectangle number 1 Perimeter = 28.00 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 % Ratio Square 6 28.57 Rectangle 3 14.29 Triangle 4 19.05 Parallelogram 3 14.29 Circle 5 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

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top