CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14

Thread: Please help

  1. #1
    Join Date
    Feb 2011
    Posts
    1

    Please help

    I just started a programming class, and I have knowledge on prgramming. Please can some one help me with this programming.

    Generally, a test plan should accompany any code you submit. The plan contains data and strategies you have used to test your code. We will have more to say about test plans in module 5. For the present, use the following information to decide if your code is working correctly:

    if you specify 40 for the number of hours worked, and 12.75 as the pay-rate, then the total wages should be $510

    Code Template

    Use the template given below. In creating your program, carefully copy the template exactly as given, maintaining all the blank lines, spaces, and general alignment. Then replace the areas that have been highlighted in yellow with your code. Do not change any of the other code.

    /*****************************************************/
    /* File: give name of your file with the source code */
    /* */
    /* Created by: give your name */
    /* Date: give the date */
    /* */
    /* Program to compute the weekly wages */
    /* */
    /* Inputs: (keyboard) */
    /* 1. No. of hours worked during a week (integer) */
    /* 2. Pay rate (dollars per hour) (float) */
    /* */
    /* Output: */
    /* weekly wages displayed on screen as a float */
    /* */
    /* Algorithm: wages = hours worked * pay rate */
    /* */
    /****************************************************/

    #include <iostream>

    using namespace std ;

    int main()

    {

    declare hours_worked as an integer ;//No. of hrs worked during week
    declare pay_rate as a float ; //Pay rate: dollars per hour
    declare wages as a float ; //Weekly wages

    // read in the hours worked

    cout << endl ;
    cout << "Number of hours worked during"
    << " the week (integer) = " ;
    cin >> hours_worked ;

    // read in the pay rate

    cout << "Hourly pay rate (specify two digits "
    << "after the decimal point) = " ;
    cin >> pay_rate ;

    // compute wages

    write assignment statement to compute wages ;

    // display the result

    cout << endl ;
    cout << "The weekly wages are: $" << wages << endl ;

    return (0); // terminate with success


    Thank you.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Please help

    It isn't clear what you're having trouble with, which "areas are highlighted in yellow", and generally what's yours versus what's in the template.

  3. #3
    Join Date
    Oct 2005
    Location
    Seattle, WA U.S.A.
    Posts
    353

    Re: Please help

    this might work for ya ...

    Code:
    #include "stdafx.h"
    #include <iostream>
    
    using namespace std ;
    
    int hours_worked;
    float pay_rate;
    float wages;
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    
    	// read in the hours worked
    	cout << endl ;
    	cout << "Number of hours worked during" << " the week (integer) = " ; 
    	cin >> hours_worked ;
    
    
    	// read in the pay rate
    	cout << "Hourly pay rate (specify two digits " << "after the decimal point) = " ;
    	cin >> pay_rate ;
    
    	wages = hours_worked * pay_rate;
    
    	cout << endl ;
    	cout << "The weekly wages are: $" << wages << endl ; 
    
    	return 0;
    }

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Please help

    Quote Originally Posted by ThermoSight View Post
    this might work for ya ...
    Why would you do somebody's homework for them. That isn't the way this forum works.

  5. #5
    Join Date
    Oct 2005
    Location
    Seattle, WA U.S.A.
    Posts
    353

    Re: Please help

    I guess 'cuz I've been there ...

    I've been in the situation where I was completely clueless about the assignment. I remember that frustration. And worse, there really was no one to ask (this was long, L O N G before the internet - I'm an Old Guy).

    So, when I see a chance to help someone at least get started, I try to help rather than sit idly by, lettin'em sweat.

    To me, Sir, the question is why did you NOT help ?

    (and besides, I was probably way too late to provide any assistance)

    Best wishes.

    bill

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Please help

    Quote Originally Posted by ThermoSight View Post
    I guess 'cuz I've been there ...

    I've been in the situation where I was completely clueless about the assignment. I remember that frustration. And worse, there really was no one to ask (this was long, L O N G before the internet - I'm an Old Guy).

    So, when I see a chance to help someone at least get started, I try to help rather than sit idly by, lettin'em sweat.

    To me, Sir, the question is why did you NOT help ?

    (and besides, I was probably way too late to provide any assistance)

    Best wishes.

    bill
    As I said, flat out doing the work isn't how this forum works.

    http://www.codeguru.com/forum/showthread.php?t=366302

    "In a very general sense, it is counter-productive to do homework for others. The very purpose of your homework is to verify that you have understood a subject and are able to apply the learned knowledge to solving specific problems. By having someone else do the assignment for you, you are not only cheating at your teachers, but also at yourself, since you pretend (and perhaps even believe) to have acquainted knowledge and skills that you actually don't have."

    Lindley asked for clarification which the OP has yet to provide, so there wasn't anything to add till the OP replies. The OP also failed to follow the posting guidelines properly.

  7. #7
    Join Date
    Oct 2005
    Location
    Seattle, WA U.S.A.
    Posts
    353

    Re: Please help

    Well certainly, Sir, I shall defer to the majesty of your Elite Member status and avoid any further comment.

  8. #8
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Please help

    Quote Originally Posted by ThermoSight View Post
    Well certainly, Sir, I shall defer to the majesty of your Elite Member status and avoid any further comment.
    I didn't write the guidelines, but I approve of them. Just doing somebody's work without even explaining what you're doing or why doesn't do anybody any good. It's more useful to nudge them in the right direction and let them figure it out themselves.

  9. #9
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Please help

    Quote Originally Posted by ThermoSight View Post
    I guess 'cuz I've been there ...

    I've been in the situation where I was completely clueless about the assignment. I remember that frustration.
    So how did you learn programming? Was it to have the answers handed to you by someone else, or did it take reading your notes and your C++ books to understand what the assignment called for?
    So, when I see a chance to help someone at least get started, I try to help rather than sit idly by, lettin'em sweat.
    Teachers use the Internet to discover possible attempts at plagiarism.

    Posting answers on a public board puts the student in jeopardy of being discovered by their teacher as being a plagiarizer if the teacher comes across your post, and the student's homework answer looks suspiciously identical to yours.
    To me, Sir, the question is why did you NOT help ?
    Maybe GCDEF was waiting for the OP to respond to Lindley's post.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; February 2nd, 2011 at 01:16 PM.

  10. #10
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Please help

    Quote Originally Posted by Paul McKenzie View Post
    Maybe GCDEF was waiting for the OP to respong to Lindley's post.

    Regards,

    Paul McKenzie
    Exactly. There's no specific question, just a homework assignment pasted in. No attempt by the OP, no indication where (s)he is stuck. Nothing to help with yet.

  11. #11
    Join Date
    Oct 2005
    Location
    Seattle, WA U.S.A.
    Posts
    353

    Re: Please help

    Gentlemen, Please, let's avoid turning this into a 'thing' (and besides, while I honestly do enjoy gettin' it on with flamethrowers, I really must leave the office for awhile).

    Still, I must admit that I am amazed that Elite Members couldn't look at that original post and immediately see where OP was stuck.

    I mean even I, with less than 285 posts (I mention that to win over GCDEF who is clearly impressed with his own numbers) could see the problem. And I was able to determine the problem without the "yellow higlighting" that others were so insistent upon having rendered.

    Gentlemen, it really has been a pleasure but the Boss is now in my office and is glaring at me. Gotta run.

    But here's the Good News: I'll be back in an hour or two when we can continue our flamethrowing and perhaps even compare ....well, you know.

    Elite Members, I salute you.

  12. #12
    Join Date
    Oct 2010
    Posts
    68

    Re: Please help

    Quote Originally Posted by ThermoSight View Post
    Still, I must admit that I am amazed that Elite Members couldn't look at that original post and immediately see where OP was stuck.
    I think you missed the point. They were very much capable of completing the homework assignment for the OP and yet chose not to.

    Quote Originally Posted by ThermoSight View Post
    I mean even I, with less than 285 posts (I mention that to win over GCDEF who is clearly impressed with his own numbers)
    This is just ridiculous...


    Quote Originally Posted by ThermoSight View Post
    Elite Members, I salute you.
    Maybe you don't want to take it from someone with 62781632781 posts, but I have <40 and I'll say that you did no service to the OP by completing the assignment for him. First of all the OP is taking a COURSE! Which means he has an INSTRUCTOR that probably taught him everything he needed to know for this assignment, PRIOR to assigning the work. This also means he will have another assignment next week. He will most likely be un-prepared for the new assignment since he didn't learn anything on the first...

    I could understand if someone was self-motivated enough to learn independently and was stuck on a particular progress checker in their book. But even then it is more beneficial to show them what they are doing wrong before posting up some working code.

  13. #13
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Please help

    My request for clarification was so that I could better understand which concepts were giving the OP the most trouble. That way, any assistance could be tailored to meet their needs.

  14. #14
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: Please help

    Quote Originally Posted by ThermoSight View Post
    ...I try to help rather than sit idly by, lettin'em sweat.
    'Lettin 'em sweat'?? The OP just said 'I'm new to programming, help me' then dumped her assignment text. I can't see how she could have put in any less effort. She sure was sweating this alright

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured