
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
please use spyder

Transcribed Image Text:In Math, an equilateral triangle is a triangle in which all three sides are equal.
You are provided with an input file ("Data.txt") containing a number of text lines. Each line
contains a record of a supposed triangle. Each record has four attributes: record number, three
sides values. The record number and the sides are separated by :' while the three attributes are
separated by one space. Figure 1 shows a sample input file.
You are asked to write a Python program that reads the content of the input file, checks whether
the sides form a triangle or not. When the sides form a triangle, finds out its type ("Equilateral' or
"Not Equilateral then computes its perimeter (P) and its area (A). There will be three cases
according sides values:
> Equilateral triangle if all sides are equal (S = Sı = S2 = S:). Then compute the
perimeter (P) and area (A) of triangle as follows:
v3
P= 35; A =-s?
- Not equilateral triangle if sides are not equal. Then compute the perimeter and area
of triangle as follows:
P = S, + S2 + S, ; A = P/2-(P/2-s.).(*/2- s2). (*/2– S»)
Not triangle if one side or more, is less than or equal zero. Then add record number in
a list of records not forming a triangle then read next record.
Your program should display for each triangle, the sides of the triangle, its perimeter and its area
as well as its type (Equilateral or Not equilateral). Your program should also display, as a comma
separated list, the numbers of records that are not a triangle. The figure 2 shows a sample output.
|1:4.5 5.5 6.555
2:0 4.56 2.9
3:6.982 7.53 8.4
Sidel
Side2
Side3
Perimeter Area
Туре
4.50
5.5e
6.55
16.55
12.23
Not Equilateral
Not Equilateral
Equilateral
Equilateral
4:2.5 2.5 2.5
6.98
2.50
7.53
2.se
8.40
2.5e
22.91
7.se
24.80
2.71
5:-3.0 5.678 5.01
6:6.0 6. 0 6.0
6.00
6.00
6.00
18.00
15.59
7:9.3 10.032 -6.0213
Records not a triangle: 2, 5, 7
Figure 1. Sample input file
Figure 2. Sample output
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- السؤال The handshake uses a pair of wires dedicated to the handshake:enq (meaning enquiry) and ack (meaning acknowledge). Extra wires are used for the data transmitted during the handshake ? الاجابات True Falsearrow_forwardSignaling (Encoding) and Modulation Techniques Draw how the bit pattern 10 0 1 1 0 1 1 would be sent using Manchester encoding Amplitude Modulation (AM) Frequency Modulation (FM) Phase Modulation (PM) You can draw the bit pattern on papers and insert them as pictures into your documentarrow_forward(nn+n2n+5n)(n!+2n) Estimate big oharrow_forward
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education