C++ Programming: From Problem Analysis To Program Design, Loose-leaf Version
C++ Programming: From Problem Analysis To Program Design, Loose-leaf Version
8th Edition
ISBN: 9781337684392
Author: Malik, D. S.
Publisher: Cengage Learning
Question
Book Icon
Chapter 4, Problem 4PE
Program Plan Intro

Program Plan

1. Variables mentioned below are used:

  • shape- choice of a shape whose appropriate dimensions are to be entered [rectangle, circle, or cylinder].
  • width- width of the rectangle.
  • length − length of the rectangle
  • radius- radius of circle or base radius of cylinder
  • height − the height of the cylinder.

Program Description:

To rewrite the program after making corrections in the order of the statement so that the user is prompted to enter shape type and proper dimensions.

Blurred answer
Students have asked these similar questions
The statements in the following program are in incorrect order. Rearrange the statements so that they prompt the user to input the shape type (rectangle, circle, or cylinder) and the appropriate dimension of the shape. The program then outputs the following information about the shape: For a rectangle, it outputs the area and perimeter; for a circle, it outputs the area and circumference; and for a cylinder, it outputs the volume and surface area. After rearranging the statements, your program should be properly indented.
. The statements in the following program are in incorrect order. Rearrange the statements so that they prompt the user to input the shape type (rectangle, circle, or cylinder) and the appropriate dimension of the shape. The program then outputs the following information about the shape: For a rectangle, it outputs the area and perimeter; for a circle, it outputs the area and circumference; and for a cylinder, it outputs the volume and surface area. After rearranging the statements, you program should be properly indented. using namespace std; #include int main () string shape; double height; #include > shape; cout << endl; if (shape = "rectangl e") cout << "Area of the circle - " << PI* pow (radius, 2.0) << endl; cout < "Circumference of the circle : << 2 * PIpow (radius, 2.0) << endl; cout < "Enter the height of the cylinder: " cin >> height cout < endl; cout < "Enter the width of the rectangle : " cin >> width; cout…
Airline companies apply baggage restrictions for their passengers. An airline company has decided to apply a 10kg limitation for passengers' hand luggage and 20kg for their normal baggage. When passengers arrive, they enter their hand and normal luggage weight from the keyboard. If passengers exceed their normal baggage allowance of 10 dollars per gram, they pay 12 dollars per kg. Accordingly, write the program that calculates the baggage price of the airline they will go to according to the baggage values entered by the arriving passenger and keeps this from closing the program for each passenger. Note: If hand and normal baggage allowances are stretched below the maximum value, the payment amount will be considered not negative. An example printout is given on the right. Geri bildirim gönder
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr