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
2 samples of water of equal volume are put into dishes and kept at room temp for several days. the water in the first dish is co
Over [174]

Answer:

Vaporization is the process by which a substance changes from its solid or liquid state to a gaseous state.

Since both liquids are of the same volume and are placed under the same temperature condition, for them to not to vaporize at the same time, they must have been in different containers.

For vaporization to take place, the volume of liquid, amount of air exposure and area of the surface must be considered.

Maybe the first liquid was in a dish which has a large opening, thereby exposing a large amount which can make water to evaporate faster, whereas the second liquid was somehow enclosed (in a deeper dish).

5 0
3 years ago
True/False
Temka [501]

Answer:

<h2>True </h2>

because it maybe have been broken or can cause minor accident.

8 0
3 years ago
Problem 4 You are designing a circuit to drive LED1, using the following circuit. The datasheet for the LED specifies that VF =
HACTEHA [7]

Answer:

a) I_LED= 1/6 A  b) Vf= 2.5V

Explanation:

Consider circuit in the attachment.

a) We will simplify current source in paraller with resistor to a voltage source in series with a resistor(see attachment 2)

Solving the circuit in attachment 2 using mesh analysis

-9+2I1+4(I1-I2)-4+2I1=0

8I1 - 4I2= 13 ............... eq 1

4+4(I2-I1)+ I2 + 2=0

4I1- 5I2 = 6 ............ eq 2

I1= 41/24 ;  I2 = 1/6; I2= I_LED

b) Solving the circuit in attachment 2 again, this time I2=0

8I1 - 4I2= 13

8I1- 4(0)=13

I1= 13/8

Vf= 4(I1- I2) -4

I2=I_LED=0

Vf= 2.5 V

4 0
4 years ago
In the combination of resistors above, consider the 1.50 µΩ and 0.75 µΩ. How can you classify the connection between these two r
Airida [17]

Answer: they are connected in series.

Explanation:

3 0
4 years ago
Please calculate the current for the circuit below
Aleks04 [339]

Answer:

The answer is "I = 0.0085106383 \ A"

Explanation:

Given:

R= 470  \ \Omega \\\\V= 4 \ v

Formula:

\to V=IR\\\\\to I = \frac{V}{R}\\\\

      = \frac{4}{470}\\\\ = 0.0085106383 \ A

3 0
3 years ago
Other questions:
  • A bridge hand consists of 13 cards. One way to evaluate a hand is to calculate the total high point count (HPC) where an ace is
    7·1 answer
  • Do NOT mix ____________________ with used oil. A) Transmission oilB) AntifreezeC) Hydraulic fluidsD) Synthetic oil
    9·1 answer
  • A 400 kg machine is placed at the mid-span of a 3.2-m simply supported steel (E = 200 x 10^9 N/m^2) beam. The machine is observe
    14·1 answer
  • A sky diver with a mass of 70 kg jumps from an aircraft. The aerodynamic drag force acting on the sky diver is known to be FD =k
    9·1 answer
  • A fire nozzle is coupled to the end of a hose with inside diameter D = 77 mm. The nozzle is smoothly contoured and its outlet di
    7·1 answer
  • import java.util.Scanner; public class FindSpecialValue { public static void main (String [] args) { Scanner scnr = new Scanner(
    11·1 answer
  • You test the lighting for the first time none of the new lights work, but the old ones do. What should you do first?
    13·2 answers
  • For Figure Below, if the elevation of the benchmark A is 25.00 m above MSL:
    14·1 answer
  • If i build thing a and thing a builds thing b did i build thing b
    5·2 answers
  • Why might there be multiple foremen on one work site?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!