## C and C++

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

This Forum Only

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.
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

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
:

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()
{

return 0;
}
```

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

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
:
:

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

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