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 subsection of the Internet requires specialized browser to access and is frequently used by cyber criminals and underground
kotykmax [81]

Answer:

c. Dark Web                                                

Explanation:

Surface web is also called visible web is a part of world wide web that can be easily searchable using search engines as its contents are indexed by the search engines such as Google and its contents are accessible by public using standard web browsers. So a is not a suitable choice.

Deep Web is called invisible web as it is not accessible or searchable to standard search engines like Google. Search engines cannot index the contents of these sites. However such sites do not requires specialized browsers to access. So b is not a suitable choice.

Dark Web: It is a part of Deep Web sites but it requires specialized software and browsers to access. These sites cannot be indexed and cannot be searchable through standard search engines. This is also called dark side of the world wide web darker which is frequently used by criminals, hackers, black markets, hit-men. Illegal activities on a massive level is takes place in the dark web such as access to stolen sensitive information, malware, drug trade and terrorist operations. These sites are temporary and keep changing addresses to lessen the risk of getting caught by govt agencies or security officials. So c is the suitable choice.

Crypto-Net is a kind of neural network which works with encrypted data which can make a prediction based on the data without disclosing the data and prediction to the 3rd party. So d is not a suitable option.

6 0
3 years ago
Select statements about Multiprocessors that are FALSE. a. Asymmetric multiprocessors are a popular form of tightly coupled arch
Inessa [10]

Answer:

The statement about Multiprocessors that is FALSE is:

a. Asymmetric multiprocessors are a popular form of tightly coupled architecture

Explanation:

Symmetric multiprocessors house two or more identical processors sharing a single main memory.  The multiprocessors are tightly coupled, and all of them can access all the connected devices without any preferential treatment of one over the others.  This is unlike asymmetric multiprocessors that do not share a single main memory.   Instead, they have distributed memories.

4 0
3 years ago
Which wireless technology connects with most mobile devices?
LenaWriter [7]

Answer:

¡) Internet

¡¡) Alexa

¡¡¡) Electronic Devices

8 0
2 years ago
Which of these YA (young adult movies is not base on a book is it A wrinkle in time, or Midnight sun,or Love,simon.
ExtremeBDS [4]
I think it’s midnight sun
4 0
3 years ago
What type of microscope requires a nonmetal sample to be prepared for viewing by coating it with a thin layer of a conductive ma
zheka24 [161]

The answer is a Scanning Electron Microscope

It is important to obtain and prepare proper samples when using SEM. The sample’s size, state, and shape are things that should be considered before the sample preparation. Some samples need to be coated. Most metals require no preparation since they can easily conduct electricity. Non-metals, however, needs to be coated with a thin layer of gold. Gold is the ideal non-metal and works most of the times.

5 0
3 years ago
Read 2 more answers
Other questions:
  • What does using indirect quotations allow a writer to do?
    7·2 answers
  • E gpa(grade point average) you need to have or you get kicked out of robotics for middle school?
    13·1 answer
  • What is data protection
    13·1 answer
  • What these large numbers in unemployment could mean long term for America?
    6·1 answer
  • If I Uninstall Nba 2k 19 from my ps4 will my career be gone forever?​
    5·2 answers
  • Fill in the blank: _________ is Google’s machine-learning artificial intelligence system that interprets people’s searches to fi
    9·1 answer
  • When using file explorer, the right-hand pane that shows the files and folders of the selected area is called the pane?
    7·1 answer
  • The number of __________ to your website that had not visited prior to the time frame being analyzed.
    9·1 answer
  • How you use ict today and how will you use it tomorrow
    14·1 answer
  • The New option is found in the ...............tab.​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!