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
The term “frivolous” implies that the author
tiny-mole [99]
Thank you for posting your question here at brainly. I hope the answer will help you. Feel free to ask more questions.
believes that the average individual does not need a smart phone 
<span>firivolous mean not serious, light, unimportant.</span>

3 0
3 years ago
Which service uses a broadband connection?
Sidana [21]

Answer:

d

Explanation:

because all in one question form

5 0
3 years ago
ANSWER ASAP!!! 12 POINTS!!!!! RIGHT ANSWERS ONLY
suter [353]

Answer:

B.

Explanation:

8 0
2 years ago
Read 2 more answers
To use Click and type feature can be used to format and enter text graphic and other items
trasher [3.6K]
No more info??? Because I can’t think of how to answer this
6 0
3 years ago
What is the basic process of programming?
NikAS [45]

Answer:

There are usually three stages to writing a program: Coding. Compiling. Debugging.

8 0
2 years ago
Other questions:
  • Describe how computer is in the last 35 years
    6·1 answer
  • On the basic of size, in how many groups do we classify the computers? Name them.<br>.​
    5·1 answer
  • Why does someone put 'human' at the end of their social media profile as a summary or description? I've seen this a lot online n
    15·1 answer
  • Select the correct answer.
    7·1 answer
  • A ____________ would be a misconfiguration of a system that allows the hacker to gain unauthorized access, whereas a____________
    12·1 answer
  • Suppose the fixed width of an aside element in a fixed layout is 300 pixels, and the fixed width of its parent element (body) is
    15·1 answer
  • Use the drop-down menus to complete the statements about message marking, categorizing, and flagging.
    13·2 answers
  • 20 POINTS!!!!!!!!!! will give brainliest
    8·1 answer
  • Four ways to improve the performance of a hard disk include.
    8·1 answer
  • Compare and contrast hardware and software.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!