Thread: Need some help

  1. #1
    Registered User
    Join Date
    Oct 2007

    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
    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
    What calculations would I have to do to get my cost?

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Well, for a start:
    parameter = (width + height) * 2;
    area = width * height;
    cost = (.25 * parameter) + (.10 * area);

    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:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed
Website Security Test