Selection statement for writing code


Background:

Selection statements (if/else if/else combinations) allow us to write code that can execute different statements based on the current values seen in a particular run of the program. We will use this to write a program that performs calculations and selectively reports on different properties of the calculated values. We will be asking the user for details describing an ellipse, and then reporting back several properties of the ellipse to the user.

First, ask the user for the vertical axis radius. They will enter a floating point number.  Second, ask the user for the horizontal axis radius. They again will enter a floating point number. Afterwards, you will report whether or not it is a circle, if it is tall, long, or neither, the ellipse's focal distance f, and the eccentricity e of the ellipse.

Descriptions:

1) Checking for a circle. On a line by itself, your program must either print" is a circle: YES "or" is a circle: NO", appropriately.

2) Tallness or longness. If the ellipse is taller than it is long, your program must print "this is a tall ellipse "on its own line. If it is longer than it is tall, your program must instead print "this is along ellipse "on its own line. If it is exactly as tall as it is long, don't print anything.

3) Focal distance.  Your program must print "focal distance, f: "followed by the actual value of the focal distance. f= √(a2-b2 ), where a is the major radius and b is the minor radius.

4) Eccentricity. Your program will calculate it, and print "eccentricity: "followed by the correct value.

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Selection statement for writing code
Reference No:- TGS0161

Expected delivery within 24 Hours