Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

By following the steps below using the test editor file from the Topic 1 assignment and a new input.txt file that will be created below,

By following the steps below using the test editor file from the Topic 1 assignment and a new "input.txt" file that will be created below, you will develop a program that reads three numbers on a line from the text file and interprets them as the length of three sides of a triangle. The program then examines the lengths of the lines and prints out:

  • "Equilateral" if the three lines are of equal (positive) length.
  • "Isosceles" if the two of the three lines are of equal (positive) length and the remaining

line is of different (positive) length that is shorter than the sum of the other two lines.

  • "Scalene" for any other valid triangle.
  • "Not a Triangle because " otherwise.

The program loops to read each line of input and processes it in turn. Use exception handling to trap input errors, and report them as "Not a Triangle because: <>".

  • Example Use Case: Create the "input.txt" file to contain the 3 lines below. Note that

the final file will contain many more than 3 lines.

1 1 1

2 2 1

2 x 3

  • Expected output:

Equilateral

Isosceles

Not a Triangle because: second line is not a number.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions