Thread: Please Help...

  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    SC
    Posts
    7

    Please Help...

    Ok, if anytime has time please help me. I'm having trouble writing a program for class. What I really need to know is what loop to use and how to set it up. Here's the problem:

    A painting company has determined for ever 160 sq ft of wall space, one gallon or paint and 3 hours of labor is required. The company charges $28.00 per hour for labor. You are to design a program that allows the user to enter the number of rooms that are to be painted, the approx. sq ft in each room( it may differ from room to room) and the price of the paint per gallon. The program should create a report that includes a fancy company header and displays the following info: (ok, I know how to do this so I'm going to skip the info)

    Your program shall use the following functions: print the headings(know this) function to calculate cost of labor, paint, and total cost; (know these) the function should return the total cost through the function name; other values should be returned by reference parameters(not exactly sure what a reference parameter is)

    Data is read from a file, and we have test data to use. Any help would be appreciate. The loop is needed for inputting the sq ft of each room to be painted. Thanks

  2. #2
    Registered User
    Join Date
    Oct 2004
    Posts
    63
    First of all, I find it always helps to come with some code you've prepared. I'm no expert myself, I'm actually still learning, and it always helps me to at least give problems a try

    This is similar to how I would make the loop to input the sq ft of each room (note: this won't compile, and most likely have bugs as I just typed it up to share my idea on the problem )
    Code:
    ask for the price of paint per gallon and store it in a variable
    ask for number of rooms and store it in a variable called number_of_rooms
    for(int i=0; i<number_of_rooms; i++) {
    
    cin << space;  // the square feet
    total_space = total_space + space;  // add this room's sq feet to the total 
    
    } // end for

  3. #3
    Banned
    Join Date
    Oct 2004
    Posts
    250
    it would go something like this...
    Code:
    #include <iostream>
    using namespace std;
    int main()
    {
        int number_of_rooms;
        int area_of_room;
        int price_of_paint;
        int labour_cost = 28;
        
        cout<<"how many rooms are to be painted ?"<<endl;
        cin >> number_of_rooms;
        cout<<"what is the area of the room in sq ft ?"<<endl;
        cin >> area_of_room;
        cout<<"what is the price of the paint"<<endl;
        cin >> price_of_paint;
        cout<<"the total price for this painting job is "(number_of_rooms)*(area_of_room)............

  4. #4
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    UGH! Can you not read directions?? We aren't here to do homework for you.

    9. Tests/Quizzes and assignments - This board has no way of policing whether people are asking for help on graded assignment. We claim no responsibility for it. However, we discourage people from asking for help on graded work without permission of the instructor.

    Do not expect us to be a substitute for your own mind. Posting your assignments word-for-word isn't going to get you anywhere. Show some effort quick or you're going to get flamed here really fast, and really bad.

    On a side note, if you were to at least put the effort in to showing something that you did to prove the only thing you know how to do isn't just copying from your book/assignment, I probably wouldn't be posting this right now.

  5. #5
    Registered User
    Join Date
    Nov 2004
    Location
    SC
    Posts
    7

    Don't post if you aren't helping

    Don't come in here complaining about what I'm doing. If you don't have something to say regarding to the questions I posted, DON'T POST.

  6. #6
    Registered User
    Join Date
    Nov 2004
    Location
    SC
    Posts
    7

    And...

    like I said I just really needed to know what loop I would use and how to set it up; I have the majority of info but didn't see the need to post it; so talk what you know instead of assuming I haven't done anything

  7. #7
    Registered User
    Join Date
    Nov 2004
    Location
    SC
    Posts
    7

    Thanks to those who have helped

    I appreciate it; and our instructor does allow us to get help outside of class

  8. #8
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Well, judging by your post, you've pasted your assignment, word for word, and didn't bother to show/say anything you've done so far. Everyone who posts homework gets the same rap as I just delt out, so it's best just to follow the forum guidelines to avoid being constantly flamed. If you're having trouble with code, just say what exactly your problem is, don't say "I need to know how to do this" without showing any of your own work and posting nothing but a word-for-word assignment question.

    And actually, I quoted the wrong thing that I meant to quote. Here's the direct link:

    http://cboard.cprogramming.com/annou...ouncementid=39
    Last edited by jverkoey; 11-05-2004 at 01:12 AM.

  9. #9
    Registered User
    Join Date
    Nov 2004
    Location
    SC
    Posts
    7

    and I've said

    instead of you getting "worked up" about what I'm doing, find something else to do; I didn't put up any other info because I didn't need to; and I want to see how other people would approach the problem; I didn't want to use the variables, etc I had but rather see examples of what I should do so I can understand what I need to do and use my own variables to solve the problem

  10. #10
    Registered User
    Join Date
    Nov 2004
    Location
    SC
    Posts
    7

    and you're the only one that's flaming

    just keep stepping if you don't like what I've posted or feel like I shouldn't be posting what I post

  11. #11
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Ok, I don't feel like arguing with you anymore, as I'm about to fall asleep, so just let's say I warned you about the homework stuff. Welcome to the boards by the way. Have a good night, and good luck with your homework.

    *tips hat*

  12. #12
    Registered User
    Join Date
    Nov 2004
    Location
    SC
    Posts
    7

    Thank You!

    and good night

  13. #13
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    while(1)
    {
    //your code goes here
    }

    that's all there is to it! I'm surprised your instructor didn't cover this better; it's not exactly advanced.

Popular pages Recent additions subscribe to a feed