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
If you want to change the speed of a layer's horizontal scrolling, what should you change?
kirill [66]

Answer: A; X coefficient

Explanation: Hope I helped out !

-Carrie

Ps. it would mean a lot if you marked brainliest

6 0
3 years ago
Why is it important to understand the basic ways in which pictures and video are stored in the computer?
nalin [4]

Answer:

This is important to understand the basic ways to store pictures and video in a computer because both of them consume a relatively large storage spaces in a the computer compared with normal text files.

Explanation:

Nowadays, many computers shipped with a SSD drive (Solid State Drive) with only around 256 - 512 Gb. With this capacity, the storage spaces left to store the pictures and video are very limited after installation of the essential software.

One common way to store pictures and video is to save them at an external hard drive. Another option is the cloud storage service such as Google Drive, Google Photo etc. These storage mediums obviate the need to store those media files into the local computer machine.

6 0
3 years ago
Assume that the client wants to retrieve the www.cnn home page but has no information about the www.cnn web server IP address. D
liberstina [14]

Answer:

You could type<em> ipconfig www.cnn</em> in command promt.

Explanation:

4 0
2 years ago
Explain the uses of computer in police department​
shusha [124]

Answer:

Not only can police officers store records and reports in online databases, but they can also use computers and hard drives to store thousands of images, reports and videos. Computers make mass storage possible, and enable giant online databases that can accurately ID suspects anywhere in the country.

5 0
3 years ago
Read 2 more answers
The art of secret writing that enables an individual to hide the contents of a message from all but the intended recipient is ca
Sedaia [141]

Answer:

The answer is "Option c".

Explanation:

Cryptography is a process, in which by using code we encrypt information and communication to be read and processed by only those expected, and the explanation of given option, that were not correct can be described as follows:

  • In option a, It is a process that encrypts data within the file, that's why it is not correct.
  • In option b, It is used for text encryption, that's why it is not correct.
  • In option d, It is a protocol which uses keys for encryption, that's why it is not correct.
4 0
3 years ago
Other questions:
  • The ____ contains the computer's "brain," the central processing unit (CPU).
    5·2 answers
  • PLEASE HELP
    8·2 answers
  • The protocol that enables computers on the Internet to communicate with one another is called _____.
    10·2 answers
  • Instant messaging is synchronous
    10·1 answer
  • The requester of sensitive information should not receive access just because of his or her clearance, position, or rank. The re
    15·1 answer
  • Without a/an ________. a computer is useless
    14·1 answer
  • Betty set up an account on a popular social networking website. She wants to know whether the privacy policy is effective for he
    14·1 answer
  • Chức năng của hàm MOD(number, divisor)?
    7·1 answer
  • Many of the first photographers were actually scientists and inventors. True or false?
    7·1 answer
  • I know I'm asking for a lot. But this is my last question. If we do it I pass my semester. help please.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!