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
Eva8 [605]
3 years ago
5

Write a C console application that will be used to determine if rectangular packages can fit inside one of a set of spheres. You

r program will prompt the user for the three dimensions that define a rectangular box; the length, the width, and the height. The interior diameter of a sphere is used to identify its size. Spheres are available in the following five sizes: 4- inch, 6-inch, 8-inch, 10-inch, and 12-inch. Your program will execute repeatedly until the user enters a value of zero for one or more of the rectangular box dimensions. After obtaining the dimensions of the rectangular box, your program will call a function named getSphereSize that determines if the box will fit inside one of the five spheres. The formula for calculating the diagonal of a rectangular box is:
Computers and Technology
1 answer:
MatroZZZ [7]3 years ago
7 0

Answer:

#include <cmath>

#include <iostream>

using namespace std;

int getSphereSize(double length, double breadth, double height) {

   double diagonal = sqrt(length * length + breadth * breadth + height * height);

   if (diagonal <= 4)

       return 4;

   if (diagonal <= 6)

       return 6;

   if (diagonal <= 8)

       return 8;

   if (diagonal <= 10)

       return 10;

   if (diagonal <= 12)

       return 12;

   return 0;

}

int main() {

   double length, breadth, height;

   int sphereCounts[5] = {0};

   int sphereSize;

   while (true) {

       // Get dimensions of the box

       cout << "Enter the dimensions of the box:\n";

       cout << "Length: ";

       cin >> length;

       cout << "Breadth: ";

       cin >> breadth;

       cout << "Height: ";

       cin >> height;

       if (length <= 0 || breadth <= 0 || height <= 0)

           break;

       sphereSize = getSphereSize(length, breadth, height);

       if (sphereSize == 0)

           cout << "The box cannot fit in any of the spheres";

       else

           cout << "The box can fit in the " << sphereSize << "-inch sphere";

       // Increment the counter

       if (sphereSize == 4)

           sphereCounts[0]++;

       else if (sphereSize == 6)

           sphereCounts[1]++;

       else if (sphereSize == 8)

           sphereCounts[2]++;

       else if (sphereSize == 10)

           sphereCounts[3]++;

       else if (sphereSize == 12)

           sphereCounts[4]++;

       cout << "\n\n";

   }

   cout << "\nNumber of 4-inch spheres: " << sphereCounts[0];

   cout << "\nNumber of 6-inch spheres: " << sphereCounts[1];

   cout << "\nNumber of 8-inch spheres: " << sphereCounts[2];

   cout << "\nNumber of 10-inch spheres: " << sphereCounts[3];

   cout << "\nNumber of 12-inch spheres: " << sphereCounts[4];

   cout << endl;

   return 0;

}

Explanation:

The "cmath" library is included in the c++ program. The getSphereSize function is used to return the sphere size the rectangle dimension can fit into. It program continuously prompts the user for the length, breadth, and height of the rectangle and passes the values to the getSphereSize function in the while but breaks if any or all of the variable value is zero.

The sizes of the sphere objects in inches are collected in an array of five integer values of zeros and are incremented by one for every match with a rectangle.

You might be interested in
A menu that drops into the work area of the display screen is called a(n) _______ menu.
Klio2033 [76]
The answer is D) pull down menu

Also called a drop-down menu, this is a menu that remains invisible until you click or hover over it, pulling up the menu options. This is useful for reducing clutter in the work area of an application, such as Excel, while keeping the tools included in the menu readily available. 
5 0
3 years ago
In​ 1972, gordon bell formulated​ bell's law, which states​ ________.
Masja [62]

I guess the best option is letter D.

In 1972, Gordon Bell formulated Bell's Law, which states a new computer class forms roughly each decade establishing a new industry.

4 0
3 years ago
Universal containers regularly imports Accounts from an external order system that has its own ID field for each record.What sho
Vikki [24]

Answer:

B. Create a unique External ID field on Accounts in SFDC for matching.                                      

Explanation:

  • External ID is used to prevent duplicate records from being created as a consequence of the import operation, when importing custom objects or person accounts.
  • An external ID is a specific field that contains the External ID attribute.
  • External ID has unique record identifiers from a system that is outside the Salesforce.
  • When this option is selected Data Import Wizard identifies existing Salesforce records with external IDs that match the values in import file.
  • The External ID field enables to keep unique record IDs from an external system, usually for integration.
  • External ID field values should be unique and determine whether or not value are case sensitive can also be determined. For example XYZ and xyz will not be considered same if case sensitive option is not selected.

6 0
3 years ago
Question is attached as image, please help :&gt;
harkovskaia [24]

Answer:

Proved

Explanation:

Given

X = (a.\bar b)+(\bar a.b)

(a + b)\ .  \frac{}{a.b}

Required

Find out why they represent the same

To do this, we simplify either (a + b)\ .  \frac{}{a.b} or X = (a.\bar b)+(\bar a.b)

In this question, I will simplify (a + b)\ .  \frac{}{a.b}

Apply de morgan's law

(a + b)\ .  \frac{}{a.b} = (a + b) . (\bar a + \bar b)

Apply distribution property

(a + b)\ .  \frac{}{a.b} = a.\bar a + a.\bar b + \bar a . b + b . \bar b

To simplify, we apply the following rules:

a.\bar a = 0 --- Inverse law

b.\bar b = 0 --- Inverse law

So, the expression becomes

(a + b)\ .  \frac{}{a.b} = 0 + a.\bar b + \bar a.b + 0

(a + b)\ .  \frac{}{a.b}  = a.\bar b + \bar a.b

Rewrite as:

(a + b)\ .  \frac{}{a.b}  = (a.\bar b)+(\bar a.b)

From the given parameters:

X = (a.\bar b)+(\bar a.b)

This implies that:

(a + b)\ .  \frac{}{a.b} when simplified is X or (a.\bar b)+(\bar a.b)

3 0
3 years ago
1. Universal Containers has set up a picklist dependency between Region and Zone on the Account object. The sales manager has re
ElenaW [278]

Answer:

Create a validation rule using ISPICKVAL()

Explanation:

Solution

This can be achieved by creating a a validation rule using ISPICKVAL()

Create a Validation Rule Based on a Pick list : The ISPICKVAL() are very important for creating validation rules that check whether a definite pick list value is chosen. for instance, say you want another person to enter a reason when they change a case's Status pick list value to increase.

3 0
3 years ago
Other questions:
  • 5255555555555+55555555555555/1111*99442
    14·2 answers
  • On the Insert tab, select Table &gt; _______ to create a table from selected text.
    14·1 answer
  • Write a program that sorts a vector of names alphabetically using the selection sort and then searches the vector for a specific
    7·1 answer
  • Marissa, a 21-year-old young woman, is working as an intern at a software company. She has recently graduated from college. She
    6·1 answer
  • Jim is in the market for a car that will last for the next 10 years and has saved up some money for the purpose of a car. What’s
    12·1 answer
  • What is software piracy?
    11·1 answer
  • 9. h=
    6·1 answer
  • The objective of this task is to use Scapy to estimate the distance, in terms of number of routers, between your VM and a select
    10·1 answer
  • Why is it important to recognize the proper boundaries or limits of algorithms?
    14·1 answer
  • A good algorithm should have which three components?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!