09-28-09 - as robust as possible though try giving text...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Circle Computations: Switch conditional statement Description This program will perform two different calculations for a circle: 0. stop execution 1. compute its circumference 2. compute its area This program will show use of a user-controlled loop, the switch conditional statement, as well as creation of constants and their use in expressions. It also show using a string variable in a prompt to get informative user prompts. This program is somewhat robust, as it does checking to see in the values the user gives make sense or are in the proper ranges. For example, when asked to input a circle radius, the program will reject negative numbers. In this case, the program goes back to the top of the loop and and has the user begin again. It is not
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: as robust as possible, though; try giving text like "hi there" when asked for a radius. Input User will supply one number, when prompted, to tell which computation is desired (in this case, 0, 1, or 2 is needed). Then, when prompted, the use will give a second number. .. the radius of the circle (units are not important and the radius can be a real number). We also show use of Number() to convert text to numeric data. Output The program will print to the screen the value (either area or circumference). Termination To end the program the user should give number "0" when selecting a conversion....
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern