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
On a timeline, a milestone 11 years in the future will be to the
aniked [119]

Answer:

D. Left,left

11 is less than 20 as well as it is less than 25 years. And we move from left to right on the timeline. Thus 11 is left of 20 and it is left of 25 years as well. And timeline is the core of a project management software. The Gantt and Pert chart are totally based on the timeline. Software like Microsoft project use the timeline quite a lot, and you cannot survive without the knowledge  of the timeline in software project management.

Explanation:

Timeline knowledge is a must for a software professional, and the above answer does not require explanation.

6 0
4 years ago
____ variables are variables that are shared by every instantiation of a class. local instance
Colt1911 [192]

These are known as class variables, so called because of the property mentioned.

4 0
3 years ago
The most basic function of firewalls is to
adelina 88 [10]
<span>A firewall is a network security system that monitors and controls the incoming and outgoing network traffic based on security rules that are configured by the network administrator.</span>
5 0
3 years ago
Suppose that we time three functions in Python: linear searching, binary searching, and sorting. We determine their running time
Igoryamba

Answer:

134

Explanation:

because 6.00×10-9 =51 and 1.80×10-8=10 and 8.00×10-7=73 by adding them it will give the answer out by the figuer 134

6 0
3 years ago
Which two actions allow the System Administrator to limit Chatter access during roll-out to a subset of Salesforce users?
Wewaii [24]

Answer:

a. Edit a Profile to "Enable Chatter" for the subset of users.

b. Create a Permission Set with the "Enable Chatter" permission for the subset of users

Explanation:

There are two ways to limit Chatter access during roll-out to a subset of Sales force users

  • through user profiles
  • through permission sets

"Enable Chatter" permission is added to the user profiles and permission sets during Chatter profile based roll-out.

a.

  • The system Administrator has to log in as Sales force administrator to perform this action.
  • Then select Profiles from Setup.
  • Click on Edit for the custom user profile.
  • Tick the Enable Chatter check box in the Administrative Permissions section.

b.

  • Search through the Permission Sets in Setup.
  • System section appears. Select System Permissions in that section.
  • Click on the Edit button .
  • Tick the Enable Chatter check box.
5 0
4 years ago
Other questions:
  • Exposing employee and customer personal data to an untrusted environment is an example of:
    9·1 answer
  • Mai has recently created her own e-mail account. Her father gave her permission to e-mail her friends and family but warned her
    11·2 answers
  • Which of the following is not a responsibility of a member of society?
    14·1 answer
  • i got a set of headphones and when i plug them into my speakers the right side only works how do i fix the left side of them
    12·1 answer
  • Write a program that computes and prints the average of the numbers in a text file. You should make use of two higher-order func
    9·1 answer
  • Tina has made a database table in access containing field name class roll number and contact number she has set primary key for
    5·1 answer
  • Please help!
    15·1 answer
  • There is only one way to change line spacing in Word.
    14·1 answer
  • How do you print a document?
    12·1 answer
  • Change the file name for index.html to index.php
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!