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
BRAINLYEST IF CORRECT!!! What is the special feature of the View Side by Side command?
xeze [42]

<u> Allows you to see two parts of the same worksheet side by side</u>

<u>Option: B</u>

<u>Explanation:</u>

The View Side by Side command helps to see the two documents side by side in Word. When using this feature, both the documents open at the same time in different windows side by side.

To view this, click the View tab in Word and then click the View side by side button. Now the document opens in two windows with side by side views. This is used to compare the documents. In case, if we want to disable this view, click the 'View Side by Side' button again so that it comes to the normal view.

6 0
3 years ago
Read 2 more answers
Explain and give examples of at least two search engines.
ale4655 [162]
Search engines are programs that search for and identify items based on a user input keyword, phrase, etc. Examples include google, bing, etc.
5 0
4 years ago
How do you copy a file​
trasher [3.6K]

Answer:

right click and press control c

8 0
3 years ago
An IT department submits a purchase order to buy a new computer from a vendor. "Purchase orders" are documents issued by buyers
Umnica [9.8K]

Answer:

Procurement

Explanation:

Characteristics hardware lifecycle:

  • Procurement- Acquiring new IT hardware assets involves evaluating vendors, purchase orders, receiving, and device labeling.
  • Deployment - Hardware configuration and installment, placing hardware and software assets into production environments.
  • Maintenance & Support - Management of assets include scheduling scans and getting audit history.
  • Upgrade - Before you retire your IT hardware assets, you’ll reach a processing plateau that can be restored with hardware upgrades.
3 0
3 years ago
What is the output of the following C++ code?
SVETLANKA909090 [29]

Answer:

Your not including anything in your code.

Explanation:

According to your text all you have is #include. You didn't incldue any directives so you will get a error.

6 0
3 years ago
Other questions:
  • What process describes using technology as a basis for controlling the access and usage of sensitive data?
    7·1 answer
  • When you append a(n) ____ to a command, the command is run in a background process?
    8·1 answer
  • How can you best utilize CSS for Web Development?
    6·1 answer
  • What role do you think mobile devices have played in shaping the world?
    13·1 answer
  • Which information is necessary to determine an object's speed?
    13·1 answer
  • Most computer attacks are designed to steal information or money. Which of the following attacks is designed to slow down or sto
    14·1 answer
  • The optional feature in a business letter is
    10·1 answer
  • The Business Information Building Block feature is available in the _____ grouping on the Insert tab.
    13·1 answer
  • Ranboo back story? (not homework i just wanna find some ppl who are interested in the same things) ft. the reddie meme
    9·2 answers
  • Why would you browse by entering a URL rather than use a link in a Web page
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!