Exercise 1: Write a python program that reads from a text file whose name is provided by the user and including lines relating to the dimensions of three kinds of shapes: Circle, Triangle, Trapezoid...


do not use java and be clear please .... your answers not all right


so, please be clear in your answer


Exercise 1:<br>Write a python program that reads from a text file whose name is provided by the user and<br>including lines relating to the dimensions of three kinds of shapes: Circle, Triangle, Trapezoid<br>(see figure below for a sample input file). For each shape compute and display its area:<br>- Triangle area = base X height.<br>- Circle area = n radius².<br>- Trapezoid area =; (base 1 + basez)X height.<br>Your program should consider the following erroneous cases:<br>The file does not open/exist<br>• The format of the data in the file is incorrect (e.g. shape name = 'Polygon'), the shape's<br>dimensions are incorrect (e.g. negative value or number of values for a trapezoid not<br>equal to 3: base,, base, and height, or), in which case RuntimeError exception should<br>be raised and the processing should continue.<br>Shape<br>Area<br>Triangle:<br>Circle: -10<br>50<br>48<br>Triangle<br>Circle<br>Trapezoid: 10 12 70<br>1200.00<br>Trapezoid: 9<br>32<br>» invalid dimension<br>Trapezoid<br>Trapezoid<br>770.00<br>> missing data.<br>Sample input file<br>Sample output<br>

Extracted text: Exercise 1: Write a python program that reads from a text file whose name is provided by the user and including lines relating to the dimensions of three kinds of shapes: Circle, Triangle, Trapezoid (see figure below for a sample input file). For each shape compute and display its area: - Triangle area = base X height. - Circle area = n radius². - Trapezoid area =; (base 1 + basez)X height. Your program should consider the following erroneous cases: The file does not open/exist • The format of the data in the file is incorrect (e.g. shape name = 'Polygon'), the shape's dimensions are incorrect (e.g. negative value or number of values for a trapezoid not equal to 3: base,, base, and height, or), in which case RuntimeError exception should be raised and the processing should continue. Shape Area Triangle: Circle: -10 50 48 Triangle Circle Trapezoid: 10 12 70 1200.00 Trapezoid: 9 32 » invalid dimension Trapezoid Trapezoid 770.00 > missing data. Sample input file Sample output

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here