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; }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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:

  1. Prompts the user to input the dimensions (in feet) of the container (radius of the base and the height).
  2. Prompts the user to input the shipping cost per liter.
  3. 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.)
  4. 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
Transcribed Image Text: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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education