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]
4 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]4 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
To close the header or footer, you should press the ________ key(s) on your keyboard.
STatiana [176]
C. Esc
Try it for yourself if you want :)
6 0
3 years ago
Jim is an experienced security professional who recently accepted a position in an organization that uses Check Point firewalls.
Contact [7]

Answer: D) CCSA

Explanation: THE CHECKPOINT CCSA(CERTIFIED SECURITY ADMINISTRATOR) is a computer based certification offered by different Computer Institutions in order to equip computer experts or systems engineers on the activities or process or knowledge needed to enhance the security domain of computer systems.

Check Point Firewall is a component of the Software Blade architecture which provides advanced firewall features like VPN and mobile device connectivity.

5 0
4 years ago
What are the inputs and outputs of the app "Spotify"?
Anastasy [175]

Hey the I/O for Spotify would be. for I or input keyboard and mouse.

and for O or output the sound files being sent from the server to the pc

Hope this helps.

-Toby  aka scav

6 0
3 years ago
Consider the following Ordinary Differential Equation:ODE : d 2y dx2 + 5 dy dx + 4y = 1 x ∈ [0; 1] BC : y(0) = 1; y 00(1) = 0 Us
tatuchka [14]

Answer:

have to go back and get a job that I don't need anymore help with that I can get a good feel about what you want me 50,000 to be able and how you feel when I get back into town for the weekend so we will have a lot to catch on the weekend and I will be sure that I will follow up on

3 0
3 years ago
To create a presentation completely by yourself, which option do you use?​
zlopas [31]

Answer: use Microsoft Power Point

Explanation:

Set up a self-running presentation

To set up a PowerPoint presentation to run automatically, do the following:

On the Slide Show tab, click Set Up Slide Show.

Under Show type, pick one of the following:

To allow the people watching your slide show to have control over when they advance the slides, select Presented by a speaker (full screen).

8 0
3 years ago
Other questions:
  • To remove any hidden days from your document before sharing it, what should you do?
    7·1 answer
  • What device acts like a wireless base station in a network, acting as a bridge between wireless and wired networks?
    11·1 answer
  • What term is used to describe the time it takes a signal to travel from one location to another on a network?
    13·1 answer
  • Let f be the following function: int f(char *s, char *t){char *p1, *p2;for(p1 = s, p2 = t; *p1 != ‘\0’&amp;&amp; *p2 != ‘\0’; p1
    6·1 answer
  • 8.7 lesson practice question 1
    13·1 answer
  • Please help!!! I am very confused about this question!
    10·1 answer
  • Sarah is having a hard time finding a template for her advertising business that she may be able to use at a later
    12·1 answer
  • A hardware component that keeps data and information when the device is not powered is called a ____ device.
    11·1 answer
  • Founder of television and Radio​
    13·2 answers
  • When a support agent does not know the answer to a question, a good incident management strategy is to tell the user ____.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!