Write a C console application that will be used to determine if rectangular packages can fit inside one of a set of spheres. Your 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:

Answers

Answer 1

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.


Related Questions

What is the final gear reduction of a compound gear reduction of 36 to 12 for the first stage and 60 to 12 for the second stage?
A. 0.067
B. 0.533
C. 8
D. 15

Answers

Answer:

8

Explanation:

Gear reduction = driven gear teeth / driving gear teeth

First stage reduction :

Driven gear teeth = 36

Driving gear teeth = 12

36 /12 = 3

Second stage reduction :

Driven gear teeth = 60

Driving gear teeth = 12

60 /12 = 5

First stage + second stage

3 + 5 = 8

If you wanted to use the numeric key pad to multiply 8 and 5 and then divide by 2, you would type
1. 8/5*2
2. 5/2/8
3. 8*5*2
4. 8*5/2

Answers

Answer:

Option 4 would be your best answer

Explanation:

The * means multiply

And the / means Divide

Hope this helps :D

4) 8*5/2 would be the correct answer to your question

PLZZ HELPP MEE!!

What projects would Excel best be used for? Be sure to say the name of the project and how you would go about creating it.

Answers

In my opinion, I believe Excel would be best used for any project really. But it will be most helpful when it comes down to reports and finance data and things like that. I would do something like how much income will I receive over the next few months to a year. And I will create a graph sowing my income for each month. But like I stated earlier, Excel is mainly used for graphs and almost every project has a graph so, it would actually be good for all things.

Hope this helps! :))

Please hellppp,is a yr 9 question

Answers

Answer:

See picture below.

Implement the ArrayMethod application containing an array that stores eight integers. The application should call the following five methods: 1. display - should display all the integers 2. displayReverse - should display all the integers in reverse order 3. displaySum - should display the sum of the integers 4. displayLessThan - should display all values less than a limiting argument 5. displayHigherThanAverage - should display all values that are higher than the calculated average value.

Answers

Answer:

public static void display(int [] arr){

   System.out.print("Arrays: ");

       for(int i =0;i<arr.length;i++){

           System.out.print(arr[i]+" ");

       }

       System.out.println();

   }

   

public static void displayReverse (int [] arr){

   System.out.print("Arrays in reverse order: ");

       for(int i=arr.length-1;i>=0;i--){

           System.out.print(arr[i]+" ");

       }

       System.out.println();

   }

   

public static int displaySum (int [] arr){

   System.out.print("Sum: ");

   int sum = 0;

       for(int i =0;i<arr.length;i++){

           sum+=arr[i];

       }

       return sum;

   }

   

public static void displayLessThan (int [] arr, int num){

       System.out.print("Less than "+num+": ");

       for(int i =0;i<arr.length;i++){

           if(arr[i]<num){

               System.out.print(arr[i]+" ");

           }

       }

       System.out.println();

   }

public static void displayHigherThanAverage  (int [] arr){

       System.out.print("Higher than average: ");

       int sum = 0;

       for(int i =0;i<arr.length;i++){

           sum+=arr[i];

       }

       float average = sum/arr.length;

       for(int i =0;i<arr.length;i++){

           if(arr[i]>average){

               System.out.print(arr[i]+" ");

           }

       }

       System.out.println();

   }

Explanation:

The methods were written in Java. See attachment for explanation where I used comments to explain each lines.

Note that lines that begin with double slash (//) are comments

Please help,it’s a year 9 question

Answers

Answer:

For an AND gate, Q would be 0,0,0,1 respectively.

See the reference table below.

When a program is adapted to run on multiple processors in a multiprocessor system, the execution time on each processor is comprised of computing time and the overhead time required for locked critical sections and/or to send data from one processor to another. Assume a program requires t = 100 s of execution time on one processor. When run p processors, each processor requires t/p s, as well as an additional 4 s of overhead, irrespective of the number of processors. Compute the per-processor execution time for 2, 4, 8, 16, 32, 64, and 128 processors. For each case, list the corresponding speedup relative to a single processor and the ratio between actual speedup versus ideal speedup (speedup if there was no overhead).

Answers

I only need points for my questions

Help fast

When comparing and what is the main difference?
O The first symbol is for reviewing text and the second for enlarging text.
The first symbol is for spacing and the second for sizing.
O The first symbol is for viewing text and the second for inserting text.
O The first symbol is for inserting text and the second for viewing text.

Answers

Answer:

The first symbol is for inserting text and the second for viewing text

Explanation:

Mrs. Toma is preparing a marksheet of Final term using Excel. She needs to 1
add a new subject title in the worksheet. Now, which component does she
need to add in her marksheet?

Answers

Answer:

a

Explanation:

compared to EMT, IMC is?​

Answers

When compared to EMT, IMC (intermediate metal conduit) is a thinner and also have a lighter-weight .

What is the comparison in IMC vs. EMT

Note that EMT  is one that cannot be threaded and is not set up for strong connections like IMC and RMC.

In regards to residential wiring, IMC is known to be the one that is said to be often and usually limited to service entrance assemblies as well as exposed and it often  runs to and fro.

Therefore, When compared to EMT, IMC (intermediate metal conduit) is a thinner and also have a lighter-weight .

Learn more about metal conduit from

https://brainly.com/question/5023977

#SPJ1

Use three or more sentences to explain to someone why they might need to use a virtual machine.

Answers

Answer:

Benefits of Virtualization

Reduced capital and operating costs.

Minimized or eliminated downtime.

Increased IT productivity, efficiency, agility and responsiveness.

Faster provisioning of applications and resources.

Greater business continuity and disaster recovery.

Simplified data center management.

If we use 6 bits for representing positive and negative numbers using 2's
complement methods, what is the value of 11100?

Answers

Answer:

-4


Explanation:
In binary, 11100 is 28
But in the two’s complement method, it will equals = (-4).
the last number always represents negative number.
In other words, if this (101010) with 6 digits. Without using two’s complement method, it would be 42 in binary. But with two’s complement method, it would ( - 22)


I hope this helps. Please don’t hesitate to ask if u concerning my answer
Yeeeeeeeeeeeeeeeeeeeeeeee

In a block of addresses we know the IP address of one host is Roll no. Roll no. Roll no. Roll no./20.What is the first address and the last address of this block? Find the number of addresses in the block?
Hint: if your roll no is 33 then your ip address will look like this: 33.33.33.33/20

Answers

Answer:

If there’s one topic that trips people up (both new and experienced) in the networking industry, it is that of Subnetting.

One of the reasons this happens is that one has to perform (mental) calculations in decimal and also binary. Another reason is that many people have not had enough practice with subnetting.

In this article, we will discuss what Subnetting is, why it came about, its usefulness, and how to do subnetting the proper way. To make this article as practical as possible, we will go through many examples.

Note: While subnetting applies to both IPv4 and IPv6, this article will only focus on IPv4. The same concepts explained here can be applied to IPv6. Moreover, subnetting in IPv6 is more of a want rather than a necessity because of the large address space.

IP address network

For example, any traffic with a destination IP address of 192.168.1.101 will be delivered to PC1, while traffic addressed to 192.168.1.250 will be delivered to SERVER.

Note: This is an oversimplification of things just for understanding sake and refers to Unicast (one-to-one) IPv4 addresses. Traffic sent to Multicast (one-to-many) and Broadcast (one-to-all) IP addresses can be delivered to multiple devices. Also, features like Network Address Translation (NAT) allow one IP address to be shared by multiple devices.

To help your understanding of IP addresses and subnetting, you need to resolve the following fact in your head: Computers think in binary, that is, 0s and 1s. Therefore, even though we see an IP address represented like 192.168.1.250, it is actually just a string of bits – 32 bits in total for IPv4 addresses.

To make them more readable for humans, IPv4 addresses are represented in dotted decimal notation where the 32 bits are divided into 4 blocks of 8 bits (also known as an octet), and each block is converted to a decimal number.

For example, 01110100 in binary is 116 in decimal:

A unicast IPv4 address such as 192.168.1.250 can be divided into two parts: Network portion and Host ID. So what does this mean? Well, IPv4 addresses were originally designed based on classes: Class A to Class E. Multicast addresses are assigned from the Class D range while Class E is reserved for experimental use, leaving us with Class A to C:

Class A: Uses the first 8 bits for the Network portion leaving 24 bits for host IDs. The leftmost bit is set to “0”.

Class B: Uses the first 16 bits for the Network portion leaving 16 bits for host IDs. The two leftmost bits are set to “10”.

Class C: Uses the first 24 bits for the Network portion leaving 8 bits for host IDs. The three leftmost bits are set to “110”.

Note: The range of Class A is actually 1-126 because 0.x.x.x and 127.x.x.x are reserved.

With these classes, a computer/device can look at the first three bits of any IP address and determine what class it belongs to. For example, the 192.168.1.250 IP address clearly falls into the Class C range.

Looking at the Host ID portion of the classes, we can determine how many hosts (or number of individual IP addresses) a network in each class will support. For example, a Class C network will ideally support up to 256 host IDs i.e. from 00000000 (decimal 0) to 11111111 (decimal 255). However, two of these addresses cannot be assigned to hosts because the first (all 0s) represents the network address while the last (all 1s) represents the broadcast address. This leaves us with 254 host IDs. A simple formula to calculate the number of hosts supported

Explanation: Final answer is Start address: 192.168.58.0 + 1 = 192.168.58.1

End address: 192.168.58.16 – 2 = 192.168.58.14

Broadcast address: 192.168.58.16 – 1 = 192.168.58.15

What episode and Season of Simpsons is this

Answers

Answer:

season 9 episode 23.65 and the bases it 12

Numerical methods are implementations of mathematical algorithms, but constructed with special consideration for accuracy of solutions and computational run-time. The order in which we implement floating point arithmetic for any numerical method will effect the accuracy of the final computed value. For this reason, extra thought must be placed on our basic mathematical operations. In this problem, you are asked to add-up the values in a large array called data. How should you do this to achieve the most accurate final sum

Answers

Answer:

find detailed description of algorithms (direct and iterative methods) in books [8], [3], [24]. We limit ourself to only selected problems and methods which are important in chemical engineering. 1.2.1 Conditioning of a system of linear equations We do not compute accurately because of rounding errors, which affect results of calcu-lations.

Explanation:

Need help ASAP. Will mark brainliest!
Which of the following is assigned to every network device?

Digital address
Logical address
MAC address
Personal address

Answers

A feature which is assigned to every (all) network device is: C. MAC address.

What is a MAC address?

MAC address is an abbreviation for media access control address and it can be defined as a unique identifier that is generally assigned by manufacturers to a network interface controller (NIC) of every (all) network device, especially for use as a network address when the device is communicating with other network devices within a network segment.

This ultimately implies that, media access control address (MAC address) is a feature which is assigned to every (all) network device by the manufacturers.

Read more on MAC address here: https://brainly.com/question/25246068

Answer: MAC Address

Explanation: Took the test and it was right :)

what percent of records are temporary, if you are not in the OSD?​

Answers

Answer:

Headed by the OSD Records Administrator, the OSD Records and Information Management (RIM) Program is responsible for oversight, implementation of the Federal Records Act within the Offices of the Secretary of Defense and the WHS supported Defense Agencies and Field Activities.

Explanation:

Use the drop-down menus to complete statements about archiving and backing up data fileArchiving data files manages the size of a mailbox for storage.
Creating an Outlook data file
data files in storage on a computer.

Answers

Answer:

Archiving data files manages the size of a mailbox for  

local

storage.

Creating an Outlook data file  

protects

data files in storage on a computer.

Explanation:

Because its right.

Answer:

an increase in cloud computing

Explanation:

to display “ hello ” message on the screen

Answers

Answer:

hello like that

it's in order

PLEASE HELP ME WITH THIS i will mark you brainlist

Answers

Answer: you have to check your email and click on the microsoft email they sent you and enter the code in the email.

Explanation: plz mark brainliest

Please answer today 20 pts!!

Type the correct answer in the box. Spell all words correctly.
Joe is a part of a team where the members come from various cultures and have different perspectives and viewpoints. What does Joe need to
improve in order to work successfully in the team?
In order to work successfully in the team, Joe needs to improve his awareness of _______.

Can only be 1 or 2 words.

Answers

Answer:

give each member their own translator and a seprate workspace

sry bout the spelling

Explanation:

The steps.txt file contains the number of steps a person has taken each day for a year. There are 365 lines in the file, and each line contains the number of steps taken during a day. (The first line is the number of steps taken on January 1st, the second line is the number of steps taken on January 2nd, and so forth.) Write a program that reads the file, then displays the average number of steps taken for each month. (The data is from a year that was not a leap year, so February has 28 days.)

Answers

Answer:

In Python:

file = open('steps.txt', 'r')

readLine = file.readlines()

begin = 0

mdays = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)

print("Month"+"\t\t"+"Average Steps")

for m in range(len(mdays)):

end = begin + mdays[m]

steps = readLine[begin:end]

sumsteps = 0

for s in steps:

 sumsteps = sumsteps + int(s)

 

average = round(sumsteps/mdays[m],1)

print(str(m+1)+"\t\t"+str(average))

begin = begin + mdays[m]

Explanation:

This line opens the step.txt file

file = open('steps.txt', 'r')

This reads the content of the file

readLine = file.readlines()

begin = 0

This initializes the months of the days to a tuple

Mmdays = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)

This prints the header

print("Month"+"\t\t"+"Average Steps")

This iterates through the tuple

for m in range(len(Mmdays)):

This calculates the days in each month

end = begin + Mmdays[m]

This gets the number of steps in each month

steps = readLine[begin:end]

This initializes the number of steps to 0

sumsteps = 0

This iteration sums up the number of steps in each month

for s in steps:

 sumsteps = sumsteps + int(s)

This calculates the average of steps rounded to 1 decimal place  

average = round(sumsteps/Mmdays[m],1)

This prints the calculated average

print(str(m+1)+"\t\t"+str(average))

This calculates the beginning of the new month

begin = begin + Mmdays[m]

Please help ASAP! will mark brianliest! 30 points!
Which popular VPN protocol allows segment access for users?

IPsec
PPTP
L2TP
SSL VPN

Answers

Answer:

SSL VPN

Explanation:

Secure Sockets Layer, or SSL VPN, is the second common VPN protocol.

A big plus for SSL VPNs is that they can allow segmented access for users. For example, users can be limited to checking email and accessing shared drives rather than having access to the entire network.

SSL VPNs come in two types, SSL portal and SSL tunnel.

SSL Portal VPNs

SSL Portal VPNs allow a user to securely access the web from a browser once the user logs into the VPN’s online portal using a specified method of authorization.

This type of SSL VPN gets its name because of how the user accesses it – through a single web page, or portal. The page acts as a single gateway to the other services available on the secured network.

SSL Tunnel VPNs

SSL Tunnel VPNs allow the user to not only access the web securely, but to also use applications and other network services that aren’t based on the web.

Due to their sophisticated segmentation capabilities, SSL VPNs often require more skill to implement.

VPNs are not a cure-all

Of course, what you could do is circumvent the entire debate around VPN SSL vs IPSEC. Our Gatekeeper offering is an enhanced alternative to VPN with no client, that still offers two-factor authentication to secure remote access.

Wherever you land between VPN SSL vs IPSEC, of if you join #TeamGatekeeper, having one of these tools to protect web traffic is a great way to help secure information, but it’s not an end-all be-all security solution.

After all, a VPN won’t protect your employees from social engineering attacks such as email phishing.

(hope this helps can i plz brainlist it will make my day :D hehe)

which of the following is not a benefit of aws cloud computing​

Answers

Answer: High latency, temporary and disposable resources are not the benefits of AWS cloud computing.

Explanation: AWS is the most reliable and broad platform that offers a wide range of feature services to individuals globally.

Hope this helps (:

The Stability and Growth Part has to do with _____.


bank reserves

the Economic and Monetary Union

U.S. trade

global money market

Answers

Answer:

The Stability and Growth Pact (SGP) is an agreement, among the 27 member states of the European Union, to facilitate and maintain the stability of the Economic and Monetary Union (EMU). ... The purpose of the pact was to ensure that fiscal discipline would be maintained and enforced in the EMU.

Explanation:

follow me for more

are used for mechanical power transmission over long distances
A. Spur Gears
B. Helical Gears
C. Planetary Gears
D. Chain and Sprockets

Answers

Answer:

D. Chain and Sprockets

Explanation:

Chains and sprockets are power transmission tools. The roller chain is connected to a toothed wheel which is the sprocket. The combination provides mechanical power to the wheels of vehicles.

An advantage they possess is their ability to transmit mechanical power over both short and long distances. They have a high degree of efficiency but they require constant lubrication. They also produce noise during operation.

of what is famous Ted Nelson?​

Answers

Answer:

Nelson proposed a system where copying and linking any text excerpt, image or form was possible.

Explanation:

Ted Nelson is one of the theoretical pioneers of the world wide web who is best known for inventing the concept of hypertext and hypermedia in the 1960s. As one of the early theorists on how a networked world would work.

How I know:

I goggle it.

i need help with this ​

Answers

Answer:

Answer is D

Explanation:

cameras did not use disks until the late 1990s  :D

edit: sorry my previous answer was wrong, I apoligize for the mishap :(

Help plz brainliest.

Answers

Answer:

Follows are the solution to this question:

Explanation:

In this question, the equation will be written as the coefficients for each of the bases, that is from the above quantum states b is given as follows:

[tex]\to | b \rangle = 0.4 | 00 \rangle + 0.65 | 01 \rangle + 0.2 | 10 \rangle + 0.61 | 11 \rangle[/tex]

Therefore the equation can be written as in the state b:

[tex]\to \mathbf{state_b = [0.4, 0.65, 0.21, 0.61]}[/tex]

HELP PLS
Which technologies have made global communication instant and more effective? Choose THREE answers.

social media
wireless devices
smart phones
automobiles
printed newspapers

Answers

Answer:

(1). social media

(2). wireless devices

(3). smart phones

Explanation:

The three technologies that have made global communication instant and more effective are social media, wireless devices, and smart phones.

Here,

Social media platforms have revolutionized the way people communicate globally. They allow individuals to connect, share information, and communicate with others in real-time, regardless of geographical location.

Wireless devices, such as laptops, tablets, and smartwatches, have eliminated the need for physical connections like cables and wires. They allow users to access the internet and communicate with others from virtually anywhere with a wireless signal.

Smartphones combine the features of a mobile phone with advanced computing capabilities. They provide instant communication through voice calls, text messages, emails, and various messaging apps.

Smartphones also allow users to access social media platforms and use wireless internet, making global communication more convenient and efficient.

Know more about communication technologies,

https://brainly.com/question/33037966

#SPJ6

Other Questions
2-10n more math homework :| Answer fasttt plsssssss NEED HELP QUIK I AM BEING TIMED and it needs to be a THREE PARAGRAPH RESPONSE and I HAVE UNTIL 2:00PM Today!!!Which group had the most influence on mesoamerican culture: Mayan, Aztec, Inca? Explain.Resources: Discovery ED Techbook (CHAPTER 7, Early Americans, Medieval and Early Modern World History - California) Write each expression as the product of its factor 24 ^2 The ratio of boys to girls in a class is 5:7 There are 36 students in the class. How many more girls than boys? -4x - 9 = 19Find x please! (Please explain how you did it too) Pleaseeeeeeeee answer if you do your the best at life!!!!! What's the estimate of 8 2/3 + 4 7/9. I really need help on this one. Help me with this math question about this expression 3.Why and how did federal Reconstruction policies falter in the South? un auto de carreras puede frenar a razn de -8.0m/s2.a.si viaja a 38m/s,cuantos metros recorrern antes de detenerse.?b.cuantos metros recorrern si viaja a 75m/s? Solve the equation. Check your solutions.|4b+4|=|2b+8| What is the slope? ASAP!!! Is the given value a solution to the equation?3(y + 8) = 2y 6y = 30 Jorge has a new job in an office. Which of the following safety procedures will he most likely need to learn? joan worked 6 hours on monday, 4 hours on wendsday and hours and 8 hours on friday. her gross pay for all 3 days was $130.50. what was her hourly rate -6, 12 ,-24 ,48 what would be the next term in this sequence (help ASAP please ) Choose the most relevant and credible evidence for this claim:1Fish can be an important part of a healthy diet.A. Health blogger Jim the Fitness Nut writes, "After I eat a fishsupper, I have energy that lasts for days!"B. Many types of fish contain high concentrations of omega-3 fattyacids, which have been shown to increase heart health.C. Almost every international cuisine has delicious recipes for fish.D. More than 32,000 species of fish have been discovered, rankingfrom large to small and dwelling in oceans, lakes, rivers, and everyother imaginable body of water. The power of an allusion comes from the reader`s understanding of the reference. How did reading the speech from Macbeth enrich your understanding of Frost`s poem? Beth is researching different ways that she could save money in a bank. She notices that the certificate of deposit requires her to leave hermoney in the bank for at least six months and that she would have to pay a fee to withdraw the money early. Why would a bank put the timerequirement on a certificate of deposit?Select the best answer from the choices provided.OA. The bank wants to make sure that only people with a lot of extra money purchase certificates of deposit.OB. The bank wants to protect customers from spending their savings by forcing them to leave the money in the bank.OC. The fixed amount of time is a deterrent to keep too many people from asking for CDs to avoid paying high interest rates.OD A set period of time lets a bank know how long it can safely lend the money to other customers.