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
Which description best applies to a macro?
Mama L [17]

A macro is that pseudo-program that performs a list of actions based on a set of instructions.

<h3>What is macro?</h3>

A macro can be said to be a number of commands that help you to get complex things done via automating simple and via repetitive tasks.

A macro is that pseudo-program that performs a list of actions based on a set of instructions.

Therefore, option A is correct as the macros does a whole lot of work.

Learn more about macro from

brainly.com/question/20050035

#SPJ1

6 0
1 year ago
Janice, who is 15, posts post a picture of herself drinking alcohol and making an obscene gesture on her social network page. wh
mars1129 [50]

answer

A and B

Explanation.

A and B are the answers because this a real life scenario.

it's also can ruin her dreams on going to college to get a degree on what she want's to be and job application on her degree or any kind of job.

8 0
2 years ago
Read 2 more answers
Which of the following is part of Connections Academy's AUP regarding the use of the school'supplied technology
sergey [27]
A)technology supplied by connections should only be used for school purposes
6 0
3 years ago
Read 2 more answers
Alcohol damages your __________, making it more difficult to understand how far away other objects are.
Zolol [24]

The answer to the blank part of the statement is vision.

When you consume alcohol, your pupils would react slower; you would be less likely to contrast dark and light objects well; your eyes would twitch if your consumption is excessive; and you have dry eye, your symptoms would be exacerbated. This is one of the reasons why people who are drunk aren’t allowed to drive, since they cannot accurately perceive the things around them due to being impaired by alcohol.

7 0
3 years ago
Which set of symbols encloses an if-then code block? Choose the best answer.
Colt1911 [192]

Here's some code that might help, assuming that you are using JavaScript.

e = "Hello"

if(e === "Hello"){

    alert(":D")

}else{

    console.log("Um.")

}

I think that the answer is curly brackets.

8 0
3 years ago
Other questions:
  • Choose the correct sequence for classifier building from the following.
    7·1 answer
  • which of the following is true about both the cyber community and the real community like the one you live in,i will give 10 poi
    6·1 answer
  • You send a report to your boss for feedback and she returns it to you with her edits noted in the electronic file. This Word fea
    11·1 answer
  • What is TRUE about the following array?
    15·1 answer
  • Give a recursive implementation for the function: def is_sorted(lst, low, high) This function is given a list of numbers, lst, a
    10·1 answer
  • List at least 5 features that can be used to format a report in word 2013
    6·1 answer
  • Two threads try to acquire the same resource at the same time and both are blocked. Then, they continually change their states i
    14·1 answer
  • (main.c File)
    7·1 answer
  • Fill in the blanks to complete a summary of this part of the passage. For the power of Patents
    6·2 answers
  • Write a program that computes how much each person in a group needs to pay (after tax and tip) when splitting the bill equally.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!