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
galben [10]
3 years ago
12

Write a program that asks for the weight of a package and the distance it is to be shipped. This information should be passed to

a calculateCharge function that computes and returns the shipping charge to be displayed . The main function should loop to handle multiple packages until a weight of 0 is entered.
Computers and Technology
1 answer:
larisa [96]3 years ago
7 0

Answer:

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

   const int WEIGHT_MIN   =    0,

             WEIGHT_MAX   =   20,

             DISTANCE_MIN =   10,

             DISTANCE_MAX = 3000;

   float package_weight,

         distance,

         total_charges;

   cout << "\nWhat is the weight (kg) of the package? ";

   cin >> package_weight;

   if (package_weight <= WEIGHT_MIN ||

       package_weight > WEIGHT_MAX)

   {

       cout << "\nWe're sorry, package weight must be\n"

            << " more than 0kg and less than 20kg.\n"

            << "Rerun the program and try again.\n"

            << endl;

   }

   else

   {

       cout << "\nDistance? ";

       cin >> distance;

       if (distance < DISTANCE_MIN ||

           distance > DISTANCE_MAX)

       {

           cout << "\nWe're sorry, the distance must be\n"       << "within 10 and 3000 miles.\n"

                << "Rerun the program and try again.\n"

                << endl;

       }

       else

       {

            if (package_weight <= 2)

               total_charges = (distance / 500) * 1.10;

           else if (package_weight > 2 &&

                   package_weight <= 6)

               total_charges = (distance / 500) * 2.20;

           else if (package_weight > 6 &&

                   package_weight <= 10)

               total_charges = (distance / 500) * 3.70;

           else if (package_weight > 10 &&

                   package_weight <= 20)

               total_charges = (distance / 500) * 4.80;

           cout << setprecision(2) << fixed

               << "Total charges are $"

               << total_charges

               << "\nFor a distance of "

               << distance

               << " miles\nand a total weight of "

               << package_weight

               << "kg.\n"

               << endl;

       }

   }

Explanation:

You might be interested in
What is sexual intercourse <br><br>​
n200080 [17]

Answer:

immmm ....

I know the answer but I won't tell..lolllll

7 0
3 years ago
Read 2 more answers
Which term describes a secure, individual, private cloud-computing model hosted within a public cloud?
grin007 [14]

The term that describes a secure, individual, private cloud-computing model hosted within a public cloud is A hybrid cloud.

<h3>What is this cloud about?</h3>

A hybrid cloud is known to be a system or a model which is said to be a form of a private cloud that is linked with public cloud infrastructure, and it is one that tends to give room for an organization to act workloads in two environments.

Note that In this model, the public cloud is known to be one that is seen and it is one that becomes an extension of the private cloud to make a single, uniform cloud.

Hence, The term that describes a secure, individual, private cloud-computing model hosted within a public cloud is A hybrid cloud.

Learn more about hybrid cloud from

brainly.com/question/27838623

#SPJ1

7 0
1 year ago
Lets computer know what to do when it starts up...
Paha777 [63]

Answer: the answer would be the "Rom chip"

Explanation:

The rom chip controls all aspects of the computer, this is also known as "BIOS" or "basic input/output system"

5 0
3 years ago
Please help i only have 20 minuets
MAXImum [283]

Answer:

The column to the left goes from bottom to top:  troposphere, stratosphere, mesosphere, thermosphere, exosphere.

The column to the right goes from bottom to top: Ozone layer, karman line, Exobase

Explanation: Hope this helps

4 0
3 years ago
Which of the following is a negative effect of the rise in agricultural technology following World War II?
Whitepunk [10]
Is it a multiple choice
6 0
3 years ago
Other questions:
  • How do type declaration statements for simple variables affect the readability of a language, considering that some languages do
    10·1 answer
  • A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
    14·1 answer
  • Ted wants to follow the StartSafe philosophy when working around electricity. Which of the following steps would be consistent w
    15·2 answers
  • Quantas calorias os adolescentes devem consumir diariamente?
    14·1 answer
  • Besides the Computer Inventory and Maintenance form, what other documentation should you keep on each computer? How might you st
    8·1 answer
  • What activities are the most likely to infect your computer vith a virus? Check all that apply.
    10·1 answer
  • **NEED HELP??!! Computer Science Questions!! KNOWING GIMP!!!!
    7·1 answer
  • Explain in details how Galen , a physician during the Middle Ages, expanded on Hippocrates' theory of the four humors and explai
    6·1 answer
  • PLEASE HURRY!!!!<br> Look at the image below
    8·1 answer
  • Select the correct answer.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!