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

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

View Full Document Right Arrow Icon
Circle Computations 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, sequential conditional statements (if-then), 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
Background 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

This note was uploaded on 11/30/2009 for the course COMP 110 taught by Professor Stotts during the Spring '08 term at UNC.

Ask a homework question - tutors are online