C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
c++ code Posted by ladybug27 on 23 Jul 2006 at 1:45 PM
anyone can help me...

translate the given statements into c++ code.

Calculate gross-pay as hours_worked multiplied by pay_rate. If gross_pay is less than 100,00, calculate as 12% of gross_pay. IF gross_pay is greater than or equal to 100.00, calculate tax as 15% of gross_pay. In either case, calculate late net-pay as tax subtracted from gross_pay.
Report
Re: c++ code Posted by tsagld on 23 Jul 2006 at 2:08 PM
: anyone can help me...
:
: translate the given statements into c++ code.
:
: Calculate gross-pay as hours_worked multiplied by pay_rate. If gross_pay is less than 100,00, calculate as 12% of gross_pay. IF gross_pay is greater than or equal to 100.00, calculate tax as 15% of gross_pay. In either case, calculate late net-pay as tax subtracted from gross_pay.
:
What part of the code you have already written gives you trouble?

Greets,
Eric Goldstein
http://www.gvh-maatwerk.nl


Report
Re: c++ code Posted by ladybug27 on 23 Jul 2006 at 2:16 PM
: : anyone can help me...
: :
: : translate the given statements into c++ code.
: :
: : Calculate gross-pay as hours_worked multiplied by pay_rate. If gross_pay is less than 100,00, calculate as 12% of gross_pay. IF gross_pay is greater than or equal to 100.00, calculate tax as 15% of gross_pay. In either case, calculate late net-pay as tax subtracted from gross_pay.
: :
: What part of the code you have already written gives you trouble?
:
: Greets,
: Eric Goldstein
: http://www.gvh-maatwerk.nl
:
: all of it.... i am confused, if someone can start me, i believe i can finish the code
:

Report
Re: c++ code Posted by stober on 23 Jul 2006 at 2:27 PM
: :
: : all of it.... i am confused, if someone can start me, i believe i can finish the code
: :
:
:


solve it with pencil & paper first, then maybe you can get starded with the C program. Also make sure you study your book and do the problems at the end of the chapters.

int main()
{
   // put your code here

   return 0;
}

Report
Re: c++ code Posted by ladybug27 on 23 Jul 2006 at 3:42 PM
: : :
: : : all of it.... i am confused, if someone can start me, i believe i can finish the code
: : :
: :
: :
:
:
: solve it with pencil & paper first, then maybe you can get starded with the C program. Also make sure you study your book and do the problems at the end of the chapters.
:
:
: int main()
: {
:    // put your code here
: 
:    return 0;
: }
: 

:

o.k. thanks

Report
Re: c++ code Posted by ladybug27 on 23 Jul 2006 at 3:46 PM
: : : :
: : : : all of it.... i am confused, if someone can start me, i believe i can finish the code
: : : :
: : :
: : :
: :
: :
: : solve it with pencil & paper first, then maybe you can get starded with the C program. Also make sure you study your book and do the problems at the end of the chapters.
: :
: :
: : int main()
: : {
: :    // put your code here
: : 
: :    return 0;
: : }
: : 

: :
:
: o.k. thanks
:
:

Report
Re: c++ code Posted by ladybug27 on 23 Jul 2006 at 3:48 PM
: : : : :
: : : : : all of it.... i am confused, if someone can start me, i believe i can finish the code
: : : : :
: : : :
: : : :
: : :
: : :
: : : solve it with pencil & paper first, then maybe you can get starded with the C program. Also make sure you study your book and do the problems at the end of the chapters.
: : :
: : :
: : : int main()
: : : {
: : :    // put your code here
: : : 
: : :    return 0;
: : : }
: : : 

: : :
: :
: : o.k. thanks
: :
: :
:
:

i know the pseudo code goes like this, now i have to do the c++
code..

> // Read in the HoursWorked (I assume you are using
> cin statements)
> // Read in the PayRate
> // Calculate the gross pay (Gross Pay = HoursWorked
> * PayRate)
> // Next Calculate the TaxRate
> // If (GrossPay < 100)
> // TaxRate = .12
> // Else
> // TaxRate = .15
> // Now we can calculate the tax
> // Tax = TaxRate * GrossPay
> // And finally the NetPay
> // NetPay = GrossPay Tax




Report
Re: c++ code Posted by AsmGuru62 on 24 Jul 2006 at 4:30 AM
: > // Read in the HoursWorked (I assume you are using
: > cin statements)
: > // Read in the PayRate
: > // Calculate the gross pay (Gross Pay = HoursWorked
: > * PayRate)
: > // Next Calculate the TaxRate
: > // If (GrossPay < 100)
: > // TaxRate = .12
: > // Else
: > // TaxRate = .15
: > // Now we can calculate the tax
: > // Tax = TaxRate * GrossPay
: > // And finally the NetPay
: > // NetPay = GrossPay Tax
:

Good!
Now start with taking user input. You need two values at first: HoursWorked and PayRate:

double HoursWorked;
double PayRate;

cout << "Please, enter hours worked: ";
cin >> HoursWorked;

// Now try to do the second one...





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.