Question:

Help me formulate this C programming problem

by  |  earlier

0 LIKES UnLike

A small airline company need a program to compute baggage charges. Write a program that ask the user to enter the weight of a passenger's baggage. The program should display the baggage charge, which is calculated as follows. If the baggage weight is 50 pounds or less, the program should display "No Charge". If the baggage weight is greater than 50 pounds, the baggage charge is $5.00 plus $0.95 for each pound over 50

 Tags:

   Report

2 ANSWERS


  1. Where are you getting stuck? This should be pretty simple:

    1. Ask the user for information

    2. Use an if else block to determine whether the package is over 50 or under 50 (look out for negatives!)

    3. Calculate accordingly


  2. your basic algorithm should look something like this -

    input bagweight from user

    if bagweight <= 50, display "No Charge"

    else do the following:

    baseweight=bagweight-50

    bagcharge=5+(baseweight*0.95)

    display "Your charge is" + bagcharge

    ---

    Make sure you input the weight correctly, checking for invalid entries.

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.