|
Pathetic wrote: Regular pay 240.00
I think this should be $420.00
Pathetic wrote: apparently the program read as input the number of hours the employee has worked.
void main( void )
{
double dHours;
std::cout << "Hours worked: ";
std::cin >> dHours;
} Only after you get past this hurdle should you continue.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
thanks! I am pretty sure this will help alot
:I
|
|
|
|
|
Hi Pathetic
Enter an Hour as an input
and you use if -else condition for hours and according to hours you caclulate the Total gross pay.
now it is easy for you to calculate the deduction using simple formulas
if hours is =< 40
than hours*dollar
else if hours is >40 and less <= 45
1) 40*dollar
2) (modify)(hours - 40)*(10.50+(10.50/2))(/modify)
else if(hours >45)
1) 40*dollar
2) 5*10.50*(10.50/2)
3) (hours-45)*2*10.50
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
|
Most Welcome
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Pseudocode = ON
include the headers you need
declare variables that you will need
ask for the hours worked
save it into "hours_worked"
temp1 = hours_worked*hour_price
when hours more than 40 but less or equal to 45
temp2 = (45-hours_worked) * (1,5*hour_price)
when more than 45
temp3 = (hours_worked - 45) * (2*hour_price)
save the total amount in a "total_pay"
give the results on the screen /* depending on how you mix the three temp variables you have one amount or the other */
taxes = (total_pay * 31) / 100.0 /* this .0 at the end is to force to have decimals in the result */
cpp = (total_pay * 1.9) / 100
ei = /* you forgot to say it in the description, but is the same */
Ud = (total_pay * 0.4) / 100
neto_pay = total_pay - taxes - cpp - ei - ud
give the results on the screen
Pseudocode = OFF
This is more or less a structure that will work. It is one of the most basics, all is done in the "main" function (you didn't say how far is the level by the first module). You can try by yourself to use secondary functions (changes are not very big) and, if you have a particular question or something is going wrong when you are typing your code, feel free to ask.
99.99% of the people is born without knowing everything, so don't worry if you need to ask something "basic", the level of the question is not important. The mos important thing is:
Pathetic wrote: I dont want anyone to like, write out the code for me, because its against the rules im pretty sure, and i learn nothing from it.
With this attitude, you are going to have a lot of help here. Good luck.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
He's saying "I have no idea how to write a program." In this case, I would imagine the parts for "include headers" and "declare variables" are going to come hard to him, maybe even be the most difficult part. Perhaps he already understands the math required, possibly...
I would ask a couple of questions:
What language are you using?
What in the world book is it that you are using, that you read it six times and don't know how to write a program...is this more of a problem of finding and/or using the IDE? (tools to create the program)?
Are there any options available of someone for you to sit down with and be shown firsthand how to get started? This may not be a problem that can be solved over a forum...
Have you explained your situation to the instructor, if there is one? This is step #1, in my experience, just open that communication line and let him/her/them know you're having trouble and what the trouble is exactly.
|
|
|
|
|
i talked to my instructor on the phone today(because he lives somewhere downtown) and he said that this course generally takes up to a year, and that doing it in a 5 month period explains why i am so totally lost. He said that I should try to take it slow. He doesnt realize that my school will make me pay for the course if it not done in 2 days.
and i am using visual c++. The book i am using is put together by the manitoba indepentdent studdy course in the year 2000. i am using a program that they gave me that was made in the year 2005. That is the main reason it doesnt help much to read the book. Visual c++ has devoloped and changed a bit since then. The course is being discontinued at the end of this year. of course, i am told this AFTER I pick the course. Well, thats just life i suppose.
Did i answer all your questions?
:I
|
|
|
|
|
Yes and by your other post it seems you do indeed have a program! Nice job!
|
|
|
|
|
He is saying as well:
I dont want anyone to like, write out the code for me, because its against the rules im pretty sure, and i learn nothing from it.
So... I didn't give a ready programm, so he has to do a bit by himself
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Completely agree. I just was trying to find out if the main part of his problem was using the IDE or taking care of "logistics" such as includes or language syntax. But it seems that he was able to write a good solution with your help, so you were right.
Cheers,
Gary
|
|
|
|
|
But it still doesnt work, unfortunetly...
"The beauty of Grace is that it makes life not fair" Relient K, Be my Escape
|
|
|
|
|
Post what you have done.
Note: when code posting put a empty space between the < > if not the page takes them as html tags
#include <stdio.h> //without spaces
#include < stdio.h > //with spaces
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
thanks for your help! how is this so far.
#include <iostream>
#include <iomanip>
using namespace std;
void main()
{//start
int hours_worked,
total_pay,
neto_pat,
taxes,
cpp,
ei,
ud
cout<<"Please enter hours worked"<<endl;
cin>>hours_worked;
if (hours_worked is =< 40)
(hours_worked*hour_price)
else if (hours_worked is >40 <= 45)
(45-hours_worked) * (1.5*hour_price)
else if(hours_worked >45)
(hours_worked - 45) * (2*hour_price)
save the total amount in a "total_pay"
give the results on the screen /* depending on how you mix the three temp variables you have one amount or the other */
cout<<"Deductions Are"<<endl;
cout<<"Taxes ="<< (total_pay * 31) / 100.0 >>endl; /* this .0 at the end is to force to have decimals in the result */
cout<<"CPP ="<< (total_pay * 2.4) / 100.0 >>endl;
cout<<"EI ="<< (total_pay * 1.9) / 100.0 >>endl;
cout<<"Union ="<< (total_pay * 0.4) / 100 >>endl;
cout<<"The Net pay for the week is"<< neto_pay = total_pay - taxes - cpp - ei - ud <<endl;
cout<<"The Gross income is"<< total_pay <<endl;
system ("PAUSE");
}
I have a few questions, but they are in latter posts. oh, and yes, i did paste what you gave me, then worked overtop of it, it takes less time that way, and Icopy and paste stuff. the stuff that is identicle to yours dont just look identicle they are identicle. those are the bits i didnt get.
"The beauty of grace is that it makes life unfair" Relient K, Be my escape
modified on Wednesday, May 28, 2008 8:22 PM
|
|
|
|
|
You are declaring all variables as ints, and it is false. Many of them will efford floats because they need decimals
I would initialize the variables.
int a = 0, b = 0, c = 0;
float d = 0.0, e = 0.0;
Do you want the user to introduce the price of one hour? Or make it constant? If first... you have forgotten to ask for it. If second you have forgotten to give a value.
If first, you will be able to make different calculations using same ratios (1x, 1.5x and 2x) for different hour_prices. If second... I would declare it as a CONSTANT
#define HPRICE 10.5
Watch out with the ; at the end of the code lines (you are missing some), and with the << >> of "endl"
cout<<"The Net pay for the week is "<< neto_pay = total_pay - taxes - cpp - ei - ud << endl
you don't need to assign the value just put the sume or substraction without the left side of ecuation.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
"Include the headers you need" - Nelek
headers as in these three??
#include math
#include iostream
#include iomanip
also, what do you mean by this??
Nelek wrote: save the total amount in a "total_pay"
give the results on the screen /* depending on how you mix the three temp variables you have one amount or the other */
how do you do that??
"The beauty of grace is that it makes life not fair" Relient K, Be my escape
modified on Wednesday, May 28, 2008 7:35 PM
|
|
|
|
|
About the headers... Yes, they should be enough, by the way... if not, the compiler will give you an error like "function not recognised" or give unnespected errors. (Sorry that my answer is not more concrete, many years without coding in c++, don't remember all headers)
Pathetic wrote: how do you do that??
From you first message:
Pathetic wrote:
hours worked 42.00
Regular pay 240.00
Overtime pay 31.50
---------------------
Total Gross Pay 451.50
Regular pay = temp1
Overtime pay = temp2 + temp3
total gross pay = temp1 + temp2 + temp3
you don't need to use more variables. So you can put it as you did with the second part (taxes)
cout<<"Total Gross pay = " << temp1+temp2+temp3 <<endl;
Ah, and check out the << >> in your code, in the taxes part you have typos be the "endl" and, on the second and third taxes you don't need to use 100.0 because you already have decimals in the other coeficients. Only in the first 31% were all ints.
P.S. Sorry about the delayment, hope it is not too late.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
too late, but still useful, thanks!
"The beauty of Grace is that it makes life not fair" Relient K, Be my Escape
|
|
|
|
|
Hi!
I need to implement bidirectional communication with a USB printer. Short story is: there can be more than one printer of the same model connected to the system at a time. I may have access to the serial numbers of the printers through the device ID (not even sure of this yet), but I need to match this up with the "friendly name" used in the spooler to be sure that I have the right printer. I also have a sort of virtual port number obtained from the registry, but that seems to be completely irrelevant.
Does anyone have any ideas how to do this? The unmodified driver (we are an OEM) cannot tell identical printers apart from the driver level, so I don't even know if this is possible. Obviously the spooler knows the difference, but the spooler interface (WritePrinter, ReadPrinter) is not bidirectional-capable in this driver.
Thanks much...
|
|
|
|
|
no reply on this one huh? Yeah, it seems to be a toughie...well just wanted to add some info I think I left out: I'm using file-based access to the port to achieve the communication. I call SetupDiGetDeviceInterfaceDetail to get the device path, and use ReadFile and WriteFile from there on.
So the problem is getting some piece of information from the SetupDi functions (or maybe CM_ functions) that I can match with something that I get from the spooler functions (OpenPrinter, GetPrinter, etc.) The SetupDi functions only give me manufacturer name, model, and serial #.
As I tried to say above, the options as I see them are:
1 retrieve serial # from spooler functions (I can get it from the other side)
2 match virtual USB port in spooler (ie "USB0001") to actual port (maybe "hub#:port#", but any format will do) <-seems more likely option
Just wanted to make sure I was being as clear as possible.
Thanks!
|
|
|
|
|
Well, I solved this. All necessary info is in this very long thread[^]"] over at HP forum.
|
|
|
|
|
Hi guys,
I am designing a system.One of the requirements is...if u user downloads something from the net i have to keep track of that.I have to keep track the amount of data downloaded,the time of the download and the site from where the data was downloaded.
Can anyone plse help me on that?
|
|
|
|
|
Knight Rider wrote: I am designing a system.
One that will run on the client side?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Ok, so what code are you using to initiate the download?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|