1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
SashulF [63]
3 years ago
5

Amanda and Tyler opened a business that specializes in shipping liquids, such as milk, juice, and water, in cylindrical containe

rs. The shipping charges depend on the amount of the liquid in the container. (For simplicity, you may assume that the container is filled to the top.) They also provide the option to paint the outside of the container for a reasonable amount. Write a program that does the following: Prompts the user to input the dimensions (in feet) of the container (radius of the base and the height). Prompts the user to input the shipping cost per liter. Prompts the user to input the paint cost per square foot. (Assume that the entire container including the top and bottom needs to be painted.) Separately outputs the shipping cost and the cost of painting. Your program must use the class cylinder Type (design in Programming Exercise 3) to store the radius of the base and the height of the container. (Note that 1 cubic feet = 28.32 liters or 1 liter = 0.353146667 cubic feet.)
Engineering
1 answer:
USPshnik [31]3 years ago
3 0

Answer:

circleType.h

#ifndef circleType_H

#define circleType_H

class circleType

{

public:

void print();

void setRadius(double r);

//Function to set the radius.

//Postcondition: if (r >= 0) radius = r;

// otherwise radius = 0;

double getRadius();

//Function to return the radius.

//Postcondition: The value of radius is returned.

double area();

//Function to return the area of a circle.

//Postcondition: Area is calculated and returned.

double circumference();

//Function to return the circumference of a circle.

//Postcondition: Circumference is calculated and returned.

circleType(double r = 0);

//Constructor with a default parameter.

//Radius is set according to the parameter.

//The default value of the radius is 0.0;

//Postcondition: radius = r;

private:

double radius;

};

#endif

circleTypeImpl.cpp

#include <iostream>

#include "circleType.h"

using namespace std;

void circleType::print()

{

cout << "Radius = " << radius

<< ", area = " << area()

<< ", circumference = " << circumference();

}

void circleType::setRadius(double r)

{

if (r >= 0)

radius = r;

else

radius = 0;

}

double circleType::getRadius()

{

return radius;

}

double circleType::area()

{

return 3.1416 * radius * radius;

}

double circleType::circumference()

{

return 2 * 3.1416 * radius;

}

circleType::circleType(double r)

{

setRadius(r);

}

cylinderType.h

#ifndef cylinderType_H

#define cylinderType_H

#include "circleType.h"

class cylinderType: public circleType

{

public:

void print();

void setHeight(double);

double getHeight();

double volume();

double area();

//returns surface area

cylinderType(double = 0, double = 0);

private:

double height;

};

#endif

cylinderTypeImpl.cpp

#include <iostream>

#include "circleType.h"

#include "cylinderType.h"

using namespace std;

cylinderType::cylinderType(double r, double h)

: circleType(r)

{

setHeight(h);

}

void cylinderType::print()

{

cout << "Radius = " << getRadius()

<< ", height = " << height

<< ", surface area = " << area()

<< ", volume = " << volume();

}

void cylinderType::setHeight(double h)

{

if (h >= 0)

height = h;

else

height = 0;

}

double cylinderType::getHeight()

{

return height;

}

double cylinderType::area()

{

return 2 * 3.1416 * getRadius() * (getRadius() + height);

}

double cylinderType::volume()

{

return 3.1416 * getRadius() * getRadius() * height;

}

main.cpp

#include <iostream>

#include <iomanip>

using namespace std;

#include "cylinderType.h"

int main()

{

double radius,height;

double shippingCostPerLi,paintCost,shippingCost=0.0;

 

cout << fixed << showpoint;

cout << setprecision(2);

cout<<"Enter the radius :";

cin>>radius;

 

cout<<"Enter the Height of the cylinder :";

cin>>height;

 

 

cout<<"Enter the shipping cost per liter :$";

cin>>shippingCostPerLi;

 

 

//Creating an instance of CylinderType by passing the radius and height as arguments

cylinderType ct(radius,height);

 

double surfaceArea=ct.area();

double vol=ct.volume();

 

 

shippingCost+=vol*28.32*shippingCostPerLi;

 

char ch;

 

cout<<"Do you want the paint the container (y/n)?";

cin>>ch;

if(ch=='y' || ch=='Y')

{

cout<<"Enter the paint cost per sq foot :$";

cin>>paintCost;    

shippingCost+=surfaceArea*paintCost;    

}    

cout<<"Total Shipping Cost :$"<<shippingCost<<endl;

 

return 0;

}

You might be interested in
Need the answer now- English<br>kailangan ang sagot ngayon-tagalog<br><br>mag practice tayo!<br>​
pychu [463]

Answer:

heirjfurifbhdnrgskeviebreo

7 0
3 years ago
You need to wear respiratory PPE whenworking around materials that may contain asbestos
choli [55]

Answer:

to prevent asbestos fibers poisoning

Explanation:

There is a potential for asbestos fibers to be released when removing asbestos-containing material,using personal protective equipment will significantly reduce your exposure to asbestos fibers.

7 0
2 years ago
Lars is a medical coder. He works for a hospital in Wisconsin but currently lives in Georgia. Lars does his work online and over
Brums [2.3K]
The answer is True because he works in one location while on another
6 0
3 years ago
Which of the following is the BEST example of statistical evidence?
alexandr1967 [171]
Well it would help if there was a picture but wild guess i’m going with B or the second choice.
5 0
3 years ago
Exercise 2. Let X be a discrete random variable with the cumulative distribution function 0 x&lt;1  F(x)= 0.5 1≤x&lt;3 1 x≥
Ivahew [28]

Answer:

(1) Calculate the probability P {X ≤ 3} is 1

(2) Calculate the probability P {1 ≤ X ≤ 2} is 0.5

Explanation:

Find attached the calculation

6 0
3 years ago
Other questions:
  • What is an aqueduct?
    6·2 answers
  • I dont undertand this coding problem (Java):
    8·1 answer
  • Assuming that a query has a buffer holding up to 3 blocks, and each block can hold two records. Use merge-sort to sort the follo
    15·1 answer
  • If Fred has already measured 14 inches of a table measuring 30 inches. How many inches does he need to measure more?
    15·1 answer
  • Which of the following is a possible unit of ultimate tensile strength?
    10·1 answer
  • Car B is traveling a distance dd ahead of car A. Both cars are traveling at 60 ft/s when the driver of B suddenly applies the br
    15·1 answer
  • COMO ES LA MADERA CUANDO LA TIERRA ES HUMEDA
    7·2 answers
  • A rigid insulated tank is divided into 2 equal compartments by a thin rigid partition. One of the compartments contains air, ass
    5·1 answer
  • If f(
    10·1 answer
  • _____ can be defined as the rate at which work is done or the amount of work done based on a period of time. (2 Points) voltage
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!