compute cost of sending air parcel

This is a discussion on compute cost of sending air parcel within the C++ Programming forums, part of the General Programming Boards category; the question asks; write a program to compute the cost of sending an airmail parcel from the UK to Australia. ...

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    36

    compute cost of sending air parcel

    the question asks;
    write a program to compute the cost of sending an airmail parcel
    from the UK to Australia. The maximum weight limit is 44 kgs. The user will enter a weight in kilos and the program computes and displays the fee. If the weight exceeds the maximum value the program warns the user and exits the program.

    so far i have done this;
    Code:
    #include<iostream>
    
    
    using namespace std;
    
    
    int main()
    {
        int kilos;
        cout << "Type weight (kilos)" << endl;
        cin >> kilos;
    
    
        if (kilos > 44);
        {
            cout << "This value is out of range" << endl;
            return 0;
        }
        else if (kilos == )
    }
    However my issue is that it wants the program to display the cost as 70 when the user enters 12. Im getting confused on how that is done.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Presumably you either have a formula for the cost, or you have a table like 0-12 -> 70, 13-24 ->105, or whatever. In the first case, you type in the formula; in the second, you can use if statements to determine which class the weight is in.

  3. #3
    Registered User
    Join Date
    Oct 2013
    Posts
    12
    would write a formula to calculate the cost. whatever is typed in, calculate the formula. if it's over 44kg then exit. Shouldn't be too difficult.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please help - Program to Compute Cost
    By abdool_raheem03 in forum C++ Programming
    Replies: 3
    Last Post: 08-13-2011, 08:18 PM
  2. compute the subsets of a set
    By k_w_s_t_a_s in forum C Programming
    Replies: 4
    Last Post: 06-01-2003, 05:54 PM
  3. how to compute tan?
    By Little Wolf in forum C++ Programming
    Replies: 1
    Last Post: 05-12-2003, 05:37 AM
  4. compute pi
    By stautze in forum C Programming
    Replies: 12
    Last Post: 08-01-2002, 08:27 PM
  5. does not compute (30/35)?!?!?!?!?!!!?!?!?!
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 11-01-2001, 03:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21