Need some help

This is a discussion on Need some help within the C++ Programming forums, part of the General Programming Boards category; Don't know how to do this, looking for some ideas A photoshop frames pictures as part of its business. All ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    33

    Need some help

    Don't know how to do this, looking for some ideas

    A photoshop frames pictures as part of its business. All frames are one inch wide. The shop charges 25 cents for each inch of frame and 10 cents for each square inch of matting material. Write a program that takes the length of width of the picture as input and calculates the cost of framing the picture.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    How would you do it on paper? That's the first step. Once you figure out how you'd do it yourself, then you can convert that algorithm into code.

    Start the conversion one step at a time. First with an empty program, then maybe by asking for the length and width of the picture, then by doing one of the calculations, etc. Compile and test the code after each step to make sure you are moving in the right direction. If you have a specific question, then feel free to ask here.

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    What calculations would I have to do to get my cost?

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Well, for a start:
    Code:
    parameter = (width + height) * 2;
    area = width * height;
    cost = (.25 * parameter) + (.10 * area);
    Right?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

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