Thread: can anyone help point me in the right direction with this?

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    25

    can anyone help point me in the right direction with this?

    Milt Walker, the chief of advertising for the Isabella Potato Industry, wants you to write a program to compute an itemized bill and total costs of his "This Spud's for You!" ad campaign. The standard black and white full-page ads have base prices as follows:



    Drillers' News (code N) $ 400

    Playperson (code P) $2000

    Outdoors (code O) $ 900

    Independent News (code I) $1200



    Each ad is allowed 15 lines of print with a rate of $20.00 for each line in excess of 15 lines. Each ad is either black and white (code B) and subject to the base prices, or is in color (code C) and subject to the following rates:



    Three color (code T) 40 percent increase over base

    Full color (code F) 60 percent increase over base



    Write a program to input Milt's choice of magazine (N, P, O, I), the number of lines of print (integer), and either black and white (B) or color(C) with a choice of three colors (T) or full color (F). Output should include an appropriate title, all the information and costs used to compute the price of an ad, and the total price of the ad



    The following data should be used to test this program:



    N10N

    N5B

    P20CF

    I10CT

    O15B

    N16CF

    M15B

    P0CT


    we are just now doing IF statements an Switch statements.....so it has to use them somehow.......he said he wants it to beable to take "N10N" for example all at once an output the proper info? but when i try to ask him he just says read the book? i have tried its no help

  2. #2
    Registered User cody's Avatar
    Join Date
    Sep 2001
    Posts
    86
    Well, you could read in the data like "N10N" as an array of chars (either from the command line or at runtime from the console), then step through it char by char and analyse each char.

    Each char represents certain costs as you have described above, so all you have to do is calculate these costs according to the char. Since there are also numbers involved you should maybe look for a way to convert a "10" (string) into a numeric 10 value...

    Give it a try.
    enjoy!
    cody
    #include "reallife.h"

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    25

    does it matter which i put first?

    say after i put the cout an cin statements to prompt the user to enter for example like u said "N10N" , i used switch for the Mag codes.........right after it i was thinking of putting some ifs like maybe " if (line<=15) linefee=$25.00; elseif (line>15) linefee==(extralinefee*(lines-15)+$25.00);" but so far we have used ifs very little think this would work? i know we can put any C++ statement in a if statement coorrrect?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Point in the right direction
    By peanutym in forum C++ Programming
    Replies: 3
    Last Post: 07-07-2008, 08:49 PM
  2. Point me in the right direction
    By vampje in forum C++ Programming
    Replies: 0
    Last Post: 06-07-2006, 03:52 AM
  3. Array of pointers to point objects
    By totalfreeloader in forum C++ Programming
    Replies: 6
    Last Post: 11-27-2003, 09:26 AM
  4. trouble with overloaded operator
    By kkurz in forum C++ Programming
    Replies: 2
    Last Post: 10-31-2003, 12:59 PM
  5. fixed point / floating point
    By confuted in forum Game Programming
    Replies: 4
    Last Post: 08-13-2002, 01:25 PM