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 the exact number of bytes in system of memory that contains (a) 64K bytes (In Binary)(b) 32M bytes
VashaNatasha [74]

Answer:

64 K bytes = 65536 bytes

32 M bytes = 33554432 bytes

Explanation:

The question expect the number of bytes in binary instead of decimal. So this is important to understand that:

  • 1K bytes = 1024 bytes (in binary)

Therefore,

  • 64 Kb = 64 x 1024 =  65536 bytes

Using the similar calculation logic, we know

  • 1M bytes = 1024 x 1024 = 1048576 bytes (in binary)

Therefore,

  • 32 M bytes = 32 x 1048576 =  33554432 bytes
5 0
3 years ago
"So far this month you have achieved $100.00 in sales, which is 50% of your total monthly goal. With only 5 more workdays this m
Rus_ich [418]

Answer:

$20 per day for next 5 working days.

Explanation:

if 50% is $100.00 another $100 need to achieve in 5 days.

100/5=20

3 0
3 years ago
Read 2 more answers
How are gems and precious metals similar?
Ierofanga [76]
The answer would be d they are both rare and valuable minerals
7 0
3 years ago
Read 2 more answers
When it comes to having certain sales skills as a hotel manager, being able to really hear, learn about, and show customers that
Tju [1.3M]

Answer:

Communication

Explanation:

The ability to communicate clearly when working with customers is a key skill because miscommunications can result in disappointment and frustration. The best customer service professionals know how to keep their communications with customers simple and leave nothing to doubt.

7 0
2 years ago
Write the correct word to complete the sentence:
spayn [35]

Answer:

Legend

Explanation:

In English language, a legend can be defined as a traditional narrative or story that is written about a particular person or past events and it's likely to either be a myth or historical facts. Thus, a legend is sometimes an unrealistic story or narration that describe a particular person or an extraordinary event that occured in the past. Also, it's a story about a particular figure, past human events or actions whose origin is unknown, unproven and undocumented in real history

Additionally, the word "legend" was derived from the Latin word "legendus" which simply means something which should be read.

Hence, the most appropriate word to complete the sentence is a legend because there are no proven and documented or written records about how Bolster the Giant terrorised the people of Cornwall. Thus, the complete mythical sentence is then written as;

"According to legend, Bolster the Giant terrorised the people of Cornwall.​"

8 0
3 years ago
Other questions:
  • Which of the following accurately completes this sentence? The Internet is ____.
    6·2 answers
  • To clean dirt and spilled electrolyte from a battery, use a dilute solution of either water and baking soda or water and A. sulf
    13·1 answer
  • Torque is defined as _____.
    7·1 answer
  • Read the paragraph.
    12·2 answers
  • Get these points why they hot!!!!!!!!!!!!!!!!!!!!
    14·2 answers
  • Was the type writer the first part of the keyboard? ​
    8·1 answer
  • Before the electronic era information was usually directly communicated and not recorded, much of the information you received w
    9·1 answer
  • ‘The increased availability of mobile digital devices has had a positive impact on how young people use their free time’. Make a
    8·1 answer
  • ____ is the process of drawing a series of increasingly detailed DFDs, until all functional primitives are identified.
    7·1 answer
  • Task 2: Typing a School Speech
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!