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
mariarad [96]
3 years ago
15

Write a program that prompts the user to enter the area of the flat cardboard. The program then outputs the length and width of

the cardboard and the length of the side of the square to be cut from the corner so that the resulting box is of maximum volume. Calculate your answer to three decimal places. Your program must contain a function that takes as input the length and width of the cardboard and returns the side of the square that should be cut to maximize the volume. The function also returns the maximum volume.
Computers and Technology
1 answer:
lyudmila [28]3 years ago
4 0

Answer:

A program in C++ was written to prompts the user to enter the area of the flat cardboard.

Explanation:

Solution:

The C++ code:

#include <iostream>

#include <iomanip>

#include <cmath>

using namespace std;

double min(double,double);

void max(double,double,double&,double&);

int main()

{double area,length,width=.001,vol,height,maxLen,mWidth,maxHeight,maxVolume=-1;

cout<<setprecision(3)<<fixed<<showpoint;

cout<<"Enter the area of the flat cardboard: ";

cin>>area;

while(width<=area)

{length=area/width;

max(length,width,vol,height);

if(vol>maxVolume)

{maxLen=length;

mWidth=width;

maxHeight=height;

maxVolume=vol;

}

width+=.001;

}

cout<<"dimensions of card to maximize the cardboard box which has a volume "

<<maxVolume<<endl;

cout<<"Length: "<<maxLen<<"\nWidth: "<<maxLen<<endl;

cout<<"dimensions of the cardboard box\n";

cout<<"Length: "<<maxLen-2*maxHeight<<"\nWidth: "

<<mWidth-2*maxHeight<<"\nHeight: "<<maxHeight<<endl;

return 0;

}

void max(double l,double w,double& max, double& maxside)

{double vol,ht;

maxside=min(l,w);

ht=.001;

max=-1;

while(maxside>ht*2)

{vol=(l-ht*2)*(w-ht*2)*ht;

if(vol>max)

{max=vol;

maxside=ht;

}

ht+=.001;

}

}

double min(double l,double w)

{if(l<w)

return l;

return w;

}

Note:  Kindly find the output code below

/*

Output for the code:

Enter the area of the flat cardboard: 23

dimensions of card to maximize the cardboard box which has a volume 0.023

Length: 4.796

Width: 4.796

dimensions of the cardboard box

Length: 4.794

Width: 4.794

Height: 0.001

*/

You might be interested in
What is meant by the term drill down?
andrezito [222]

Answer:

 The drill down term is basically used in the information technology for the explore the multidimensional information or data by navigating the different layers of the data from the web page applications.  

Drill down basically involve in the database by accessing the specific information through the database queries. Each query basically increase the data granularity. This term is also involve with the link for represent the details more specifically.

The drill down is the simple approach or technique for dividing the complex problems into small parts so that it make the technique more efficient.

7 0
3 years ago
Communication is used to satisfy instrumental goals, which means ________ .
Ann [662]
Communication comes in lots of types, therefore, it also has lots of goals and purposes. One of the purpose of communication is to satisfy instrument goals. Instrument goals here refers to the goal that focuses on convincing others to act in an appropriate way. This is most applicable in situations when someone had to deal with others. 
3 0
3 years ago
Read 2 more answers
most dialog boxes in windows programs requiring navigation follow a similar procedure. true or false.
vfiekz [6]
I believe that is true

Hope this helps!! :)

8 0
2 years ago
Why is there no window on dishwsher
olchik [2.2K]

Because most people really don't want or need to see what's in there.

If you want to, open the door during the cycle. It won't harm anything.

If you're curious to see a dishwasher in action, some appliance showrooms have a display model, where the spray parts and the racks are in an entirely transparent box. They're to show how powerfully and completely the stuff inside will get cleaned, but you can also see how the dishwasher is intended to work, by filling with just a couple of inches of water, and then recirculating it for the duration of the cycle, to loosen the stuff on the dishes.

3 0
2 years ago
Read 2 more answers
A(n) _____ is a flexible tool used to analyze data using reports that do not have a predetermined format.
Mandarinka [93]

Answer:

decision support system

Explanation:

4 0
2 years ago
Other questions:
  • Suppose the program counter (pc) is set to 0x2000 0000. is it possible to use the jump (j) mips assembly instruction to set the
    15·1 answer
  • If you want to open an application that does not have a tile pinned to the start menu
    9·1 answer
  • Explain the difference between an i/o‐bound process and a cpu‐bound process.
    12·1 answer
  • A computer ____ is a potentially damaging computer program that affects a computer negatively by altering the way the computer w
    11·1 answer
  • 1. Implement a method factorial(int n), that takes a number (int) and returns its factorial. Factorial of an integer is the prod
    13·1 answer
  • Enter the answer.
    11·2 answers
  • Where does the list of incoming mail appear in gmail
    13·2 answers
  • If anyone can help please and thank you before Nov 11th
    15·1 answer
  • You already know how to use lists. What is the index of 5 in the following list?
    9·1 answer
  • Write the logical Expression and Draw the Truth table for the <br> following questions
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!