1. Engineering
  2. Computer Science
  3. the program should contain five functions main function for the...

Question: the program should contain five functions main function for the...

Question details

The program should contain five functions:

  1. Main function for the program
  2. a function named pizzaweight that accepts one number for the radius and returns the weight of a thin circular pizza
  3. a function named pizzaweight that accepts two numbers, for the length and width. It returns the weight of a thin rectangular pizza
  4. a function named pizzaweight that accepts one number for the radius and a string for the depth. It returns the weight of a circular pizza which may be thin, medium, or thick.
  5. a function named pizzaweight that accepts two numbers, for the length and width, as well as a string for the depth. It returns the weight of a rectangular pizza which may be thin, medium, or thick.

Assume:

In your main function, test out each of your other functions. (You do not need to have user input in this program. Instead you can just set variable values.) Hint: You can use the function compare to compare two strings. For example:

string strA;

string strB;

strA=_hello_;

strB=_bye_;

if(strA.compare(strB)==0)

{cout<_<_They are the same._<_<endl;}

This is the program so far. But I can't seem to put this together correctly. Not sure how to test the functions for the main or write out the other four functions.

//Program is asking users for height, weight, radius, length of a pizza.

//Program will calculate values based on user inputs.

#include <iostream>

#include <cmath>

#include <string>

using namespace std;

//Function declaration of calculating a pizza weight.

int x, ThinHeight, MedHeight, ThickHeight, R, H, W, L, Weight, Density, Circular, Rectangle;

int main()

{

double pi=3.14;

ThinHeight = 4mm;

MedHeight = 10mm;

ThickHeight = 22mm;

Density = 112 kg/m^3;

Circular = pi*pow(R,2)*H;

Rectangle = L*W*H;

string Depth;

}

//Function to find pizzaweight with only radius of a circular pizza.

double Circular()

{

    double R,H;

    H=4;

    double pi=3.14;

            cout<<"Enter Radius "<<endl;

            cin>>R;

            Circular = pi*pow(R,2)*H;

            return Circular;

       }

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution