Nope, not those triangles. We’re talking about geometric triangles—three-sided polygons.
In this assignment, you will write a
bash script called
tsp which will classify a triangle. It will take, as command-line
arguments, the lengths of the three sides of a triangle, and classify
the triangle as exactly one of:
|Right:||A 90° angle, per the Pythagorean Theorem: a²+b²=c².|
|Equilateral:||All three sides are the same length.|
|Isosceles:||Two sides, but not three, are the same length.|
|Scalene:||No sides are the same length.|
|Not a triangle:||For example, lengths of 1, 2, and 9. They just don’t fit together!|
Here are some of the ways that we will test your program. You can try your program with these arguments, and fix any problems you may have, or you can wait and let us find your problems. Your grade will reflect your choice.
|not a triangle|
Here are some bad inputs, which must generate only an error message.
0 0 0, it would be wrong for the program to complain about the arguments not being ≥ 1, and then go on to declare this an equilateral triangle.
Fish 0, it doesn't matter which requirement you complain about. Pick one, complain, and that should be all.
bashscript, and not use any other languages such as
awk. You may use programs such as
Follow the directions on the homework page.
Produce a poor error message. For example, “bad number” doesn’t tell me what argument it didn’t like, or what was so bad about it.
Turn in someone else’s work.
User: Guest                 Check: HTML CSS
Edit History Source
Apply to CSU |
Contact CSU |
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University