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
In PowerPoint, a type of chart that, rather than showing numerical data, illustrates a relationship or logical flow between diff
Lynna [10]

Answer:

A. SmartArt

Explanation:

SmartArt is a graphical tool used to visually communicate information.

8 0
3 years ago
Six causes of data lost
Serhud [2]
Hard drive failures

Accidental deletions

Computer viruses and malware infections



Power failures
6 0
3 years ago
Sharon is troubleshooting a computer and wants to test the hard drive in another computer. Sharon removes the hard drive and not
andreyandreev [35.5K]

Answer:

Sharon would need a 'Molex connector' to test the hard drive she is using.

Explanation:

4 0
3 years ago
Suppose a local area network requires eight characters for a password. The first character must be a letter, but the remaining s
Elis [28]

Answer: 2037468266496

Explanation:

The question says first character must be a letter = A - Z ( 26 characters )

Others can either be letters or digits = digits with range 0-9 ( 10 digits )

From the second to the seventh character can either be digits or letter hence we have ( 10 +26 ) = 36 chances

Considering rule of product

Number of chances/outcomes of the password = ( 26×36⁷)

The power of 7 was as a result of remaining seven characters can be either a letter or digits.

5 0
3 years ago
You must configure an ip address on a catalyst 2950 xl switch using the default management switch port. from global configuratio
BlackZzzverrR [31]
Int vlan 1ip address 192.168.10.2 255.255.255.0
Is the command that definitely would you enter to configure the correct management port. So we must configure the IP address on a catalyst 2950xl switch using the default management switch port from the global configuration mode. The answer in this question is int vlan 1ip address 192.168.10.2 255.255.255.0 

7 0
3 years ago
Other questions:
  • The faster the film (the higher the ISO), the more visible its grain. When you are using higher ISO, you are not just bringing g
    5·2 answers
  • While investigating the settings on your SOHO router, you find two IP addresses reported on the device’s routing table, which is
    15·1 answer
  • Janelle is shopping for jeans from Express. She clicks on a style she likes. The site quickly presents her with a close-up view
    5·1 answer
  • To quit Word, click the Restore button on the right side of the title bar. <br> True <br> False
    6·1 answer
  • Jeanne writes a song, and Raul wants to perform
    6·2 answers
  • The CUSTOMERS and SALES tables contain these columns:
    6·1 answer
  • Which of the following statements is TRUE?
    11·1 answer
  • mr. Jones put the same amount of soil around each of the five plants he has six bags of soil how many bags of potting soil did m
    14·1 answer
  • Your company just installed a new web server within your DMZ. You have been asked to open up the port for secure web browsing on
    5·1 answer
  • Which is a linear presentation?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!