|
-
February 15th, 2009, 01:22 AM
#1
Someone help please?
I am new to programming and I am having problems doing this. Can anyone pm me the solution to this? I want to compare mine to another persons. Thanks.
"Develop an algorithm that will determine the gross pay of a particular employee. You need to read the hourly rate, and the amount of hours worked by the employee. You should display the hours, hourly rate, and gross pay of the employee. If the hours worked exceed 40 compute the overtime will be paid 1.5 *hourly rate."
-
February 15th, 2009, 04:29 AM
#2
Re: Someone help please?
Unfortunately, my little son 11 yrears old, is not home now to solve your problem.
However, you can take a look at Can you help me with my homework assignment?
-
February 15th, 2009, 08:56 AM
#3
Re: Someone help please?
You want to compare yours to ours....
So, why don't you post your solution and we can give you feedback on it?
-
February 15th, 2009, 10:01 AM
#4
Re: Someone help please?
Last edited by nubcoder01; February 15th, 2009 at 09:59 PM.
-
February 15th, 2009, 11:21 AM
#5
Re: Someone help please?
1. Please, always use Code tags while posting code snippets. See Announcement: Before you post....
2. Your code cannot be compiled. What are hours, rate, hrsworked , overtime, overtimerate, Grosspay2, hourlyrate, grosspay2? Where and how are they defined?
Victor Nijegorodov
-
February 15th, 2009, 11:24 AM
#6
Re: Someone help please?
Also... code is case sensitive.
-
February 15th, 2009, 02:04 PM
#7
Re: Someone help please?
 Originally Posted by nubcoder01
I am new to programming and I am having problems doing this. Can anyone pm me the solution to this? I want to compare mine to another persons. Thanks.
It's a mistake to come in here an insult our intelligence.
-
February 15th, 2009, 03:55 PM
#8
Re: Someone help please?
Sorry guys, it's just I'm really new to this stuff. My teacher literally handed me this book called "C Primer Plus 5th edition" and told me to this assignment. I am so clueless. Any advice is appreciated. Where to start? Am I even on the right track? Help!?!?
-
February 15th, 2009, 03:59 PM
#9
Re: Someone help please?
Last edited by nubcoder01; February 15th, 2009 at 09:50 PM.
-
February 15th, 2009, 06:52 PM
#10
Re: Someone help please?
 Originally Posted by nubcoder01
Can anyone at least help me on where/how I should start this?
Code:
int main()
{
// fill this in
}
Honestly I am not even sure where to start.....what I posted before is just a bunch of random things that really don't make much sense to me.
So what do you want us to do? I'll give you a test:
Write a C++ "Hello World" program.
If you can't do this properly, then it's futile asking for help with this problem you're having. From what you've written, you shouldn't be able to write a proper "Hello World" C++ program, since there are so many basic beginner errors in the code you posted.
I suggest you read your book from chapter 1 until you understand everything in chapter 1.
Regards,
Paul McKenzie
-
February 15th, 2009, 07:53 PM
#11
Re: Someone help please?
 Originally Posted by Paul McKenzie
Code:
int main()
{
// fill this in
}
So what do you want us to do? I'll give you a test:
Write a C++ "Hello World" program.
If you can't do this properly, then it's futile asking for help with this problem you're having. From what you've written, you shouldn't be able to write a proper "Hello World" C++ program, since there are so many basic beginner errors in the code you posted.
I suggest you read your book from chapter 1 until you understand everything in chapter 1.
Regards,
Paul McKenzie
Here:
#include <stdio.h>
#include <stdlib.h>
main(){
printf("Hello World! \n");
}
-
February 15th, 2009, 09:50 PM
#12
Re: Someone help please?
What's wrong with this? It is not compiling.......
#include <stdio.h>
#include <stdlib.h>
main(){
double hours, rate, grosspay, overtimepay;
printf("Hours:\n");
scanf("%lf", &hours);
printf("Rate:\n");
scanf("%lf", &rate);
if(hours>40)
overtimepay = 40 * rate + (hours - 40) * rate * 1.5;
printf("Over time pay = %lf\n", overtimepay);
else
grosspay = hours * rate;
printf("Grosspay = %lf\n", grosspay);
system("pause");
Last edited by nubcoder01; February 15th, 2009 at 10:12 PM.
-
February 15th, 2009, 10:40 PM
#13
Re: Someone help please?
 Originally Posted by nubcoder01
Here:
#include <stdio.h>
#include <stdlib.h>
main(){
printf("Hello World! \n");
}
No. This is not a correct C++ "Hello World" program.
Code:
Thank you for testing your code with Comeau C/C++!
Tell others about http://www.comeaucomputing.com/tryitout !
Your Comeau C/C++ test results are as follows:
Comeau C/C++ 4.3.10.1 (Oct 6 2008 11:28:09) for ONLINE_EVALUATION_BETA2
Copyright 1988-2008 Comeau Computing. All rights reserved.
MODE:strict errors C++ C++0x_extensions
"ComeauTest.c", line 4: error: return type "int" omitted in declaration of function
"main", so use int main() OR int main(int argc, char *argv[])
main(){
^
1 error detected in the compilation of "ComeauTest.c".
In strict mode, with -tused, Compile failed
The following is a correct C++ "Hello World" program:
Code:
#include <iostream>
int main()
{
std::cout << "Hello World";
}
See the difference?
Also, are you coding in 'C' or C++. If it's 'C' please say so.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; February 15th, 2009 at 10:48 PM.
-
February 15th, 2009, 10:42 PM
#14
Re: Someone help please?
At the very least, list the compiler errors. The first error is obvious, as my last post shows. Also, please use code tags when posting code. See how the code I post is formatted nicely, and yours is ragged? The magic of code tags makes the code readable.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; February 15th, 2009 at 10:47 PM.
-
February 16th, 2009, 03:48 AM
#15
Re: Someone help please?
What's wrong with this? It is not compiling.......
You if/else statement is missing {}. Check MSDN on how to use if/else.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|