Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

c++ code

ladybug27ladybug27 Member Posts: 6
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.

Comments

  • tsagldtsagld Member Posts: 621
    : 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


  • ladybug27ladybug27 Member Posts: 6
    : : 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
    :

  • stoberstober Member Posts: 9,765 ✭✭✭
    : :
    : : 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.

    [code]
    int main()
    {
    // put your code here

    return 0;
    }
    [/code]
  • ladybug27ladybug27 Member Posts: 6
    : : :
    : : : 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.
    :
    : [code]
    : int main()
    : {
    : // put your code here
    :
    : return 0;
    : }
    : [/code]
    :

    o.k. thanks

  • ladybug27ladybug27 Member Posts: 6
    : : : :
    : : : : 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.
    : :
    : : [code]
    : : int main()
    : : {
    : : // put your code here
    : :
    : : return 0;
    : : }
    : : [/code]
    : :
    :
    : o.k. thanks
    :
    :

  • ladybug27ladybug27 Member Posts: 6
    : : : : :
    : : : : : 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.
    : : :
    : : : [code]
    : : : int main()
    : : : {
    : : : // put your code here
    : : :
    : : : return 0;
    : : : }
    : : : [/code]
    : : :
    : :
    : : 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




  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : > // 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
    :
    [blue]
    Good!
    Now start with taking user input. You need two values at first: HoursWorked and PayRate:

    [code]
    double HoursWorked;
    double PayRate;

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

    // Now try to do the second one...
    [/code]
    [/blue]
Sign In or Register to comment.