c++ my code is attached, along with an image of what problem i am experiencing. I know the code works fine, but when running it in the window in this particular form, my results show zero per the image i have attached and highlighted. *please note, i enter the input as follows. 5 space 10, enter then 2, enter then 1 i have also tried 5, enter, 10, enter then 2, enter then 1 and nothing works. Amanda and Tyler opened a business that specializes in shipping liquids, such as milk, juice, and water, in cylindrical containers. 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 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 cylinderType (designed 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.) Format your output with setprecision(2) to ensure the proper number of decimals for testing! Also, beware of floating-point errors in your calculations. #include #include using namespace std; #define pi 3.141592 // pi is the value of 22/7 #define convert 28.320075 //28.32 will be used as convert, which is the conversion value of 1 cubic foot to litre class cylinderType{ double radius, height,volume,surface_area; //stores radius, height, volume and total surface area public: cylinderType(double radius,double height){ //constructor this->radius=radius; this->height=height; this->volume=pi*radius*radius*height; //calculate volume this->surface_area=2.0*pi*radius*(radius+ height); //Assuming that paint in applied on the top and bottom as well // cout<<"vol "<volume<<" "<surface_area<volume*convert)*shipping_rate; double total_painting_cost=this->surface_area*painting_rate; //This part prints Output cout<<"\nTotal Cost for Shipping: "<>rad>>len; cylinderType container(rad,len); //container is the instance of class cylinderType //This part takes Shipping rate as input cout<<"Enter Shipping Cost per Litre: "; cin>>shipping_rate; //This part takes painting rate as input cout<<"Enter the paint cost per square foot: "; cin>>painting_rate; //Call to print_total_cost() function to get results container.print_total_cost(shipping_rate,painting_rate); return 0; }
c++
my code is attached, along with an image of what problem i am experiencing. I know the code works fine, but when running it in the window in this particular form, my results show zero per the image i have attached and highlighted.
*please note, i enter the input as follows.
5 space 10, enter then 2, enter then 1
i have also tried 5, enter, 10, enter then 2, enter then 1 and nothing works.
Amanda and Tyler opened a business that specializes in shipping liquids, such as milk, juice, and water, in cylindrical containers. 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 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 cylinderType (designed 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.)
Format your output with setprecision(2) to ensure the proper number of decimals for testing! Also, beware of floating-point errors in your calculations.
#include <iostream>
#include<iomanip>
using namespace std;
#define pi 3.141592 // pi is the value of 22/7
#define convert 28.320075 //28.32 will be used as convert, which is the conversion value of 1 cubic foot to litre
class cylinderType{
double radius, height,volume,surface_area; //stores radius, height, volume and total surface area
public:
cylinderType(double radius,double height){ //constructor
this->radius=radius;
this->height=height;
this->volume=pi*radius*radius*height; //calculate volume
this->surface_area=2.0*pi*radius*(radius+ height); //Assuming that paint in applied on the top and bottom as well
// cout<<"vol "<<this->volume<<" "<<this->surface_area<<endl;
}
void print_total_cost(double shipping_rate,double painting_rate){ //Function to calculate and print results
//This part calculates total cost for shipping and painting
double total_shipping_cost=(this->volume*convert)*shipping_rate;
double total_painting_cost=this->surface_area*painting_rate;
//This part prints Output
cout<<"\nTotal Cost for Shipping: "<<fixed<<setprecision(2)<<total_shipping_cost<<endl;
cout<<"Total Cost for Painting: "<<fixed<<setprecision(2)<<total_painting_cost<<endl;
}
};
int main()
{
//This part takes Dimension as User Input & creates object of cylinderType
double len,rad,shipping_rate,painting_rate;
cout<<"Enter the radius and height(in feet) for container: ";
cin>>rad>>len;
cylinderType container(rad,len); //container is the instance of class cylinderType
//This part takes Shipping rate as input
cout<<"Enter Shipping Cost per Litre: ";
cin>>shipping_rate;
//This part takes painting rate as input
cout<<"Enter the paint cost per square foot: ";
cin>>painting_rate;
//Call to print_total_cost() function to get results
container.print_total_cost(shipping_rate,painting_rate);
return 0;
}
![main.cpp
+
>- Terminal
+
User Input & creates object of Enter the radius and height(in feet)
cylinderType
for container: 5 10
double len, rad, shipping_rate Enter Shipping Cost per Litre: 2
painting_rate;
cout<<"Enter the radius and
33
Enter the paint cost per square foot: 1
business that specializes
34
milk, juice, and water, in
height(in feet) for containe :
Total Cost for Shipping: 0.00
hipping charges depend on
cin>>rad>>len;
Total Cost for Painting: 0.00
35
he container. (For
cylinderType container(rad,l
36
that the container is filled
//container is the
e the option to paint the
instance of class cylinderType
37
a reasonable amount. Write
38 //This part takes Shipping rat
owing:
input
39
cout<<"Enter Shipping Cost pe
ut the dimensions (in feet)
Litre: ";
of the base and the height).
40
cin>>shipping_rate;
41
ut the shipping cost per
42 //This part takes painting rate
input
43
cout<<"Enter the paint cost
ut the paint cost per square
square foot: ";
ntire container including
44
cin>>painting_rate;
45
ds to be painted.)
46 //Call to print_total_cost()
shipping cost and the cost
function to get results](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd248ad0b-fe53-4ae5-b8b2-1d06d59be2e8%2Fbec768dc-fb07-4891-a763-f2e145bc995a%2Fsbmh4kq_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)