Here is a second one I am stuck on. This one is working correctly, but I didn't know how to go about doing a function for the output of line 9 so that put me into problem of not being able to figure out how to get line 10 to output the Lifetime Learning Credit.

I was supposed to do a function for line 9:

The function shall take two input arguments:
the line 7 amount and the line 8 amount.
o The function will test if line 7 is equal to or more than line 8, and then compute
the correct results for line 9.
o The function will return the floating point result.
o No other computations should be performed within this function.
Examples: Input arguments of line 7 = 15000 and line 8 = 10000 would return 1.0
Input arguments of line 7 = 12222 and line 8 = 20000 would return 0.6111

Line 10 is supposed to be:

Multiply line 4 by line 9 and enter result on line 10.
This is your Lifetime Learning Credit. Enter the line 10 results on Form 1040, line 49.

#include <iostream>
#include <iomanip>

using namespace std;

const double EXPENSE_LIMIT = 10000;               //limited amount of expenses to claim
const double INCOME_LIMIT1 = 61000;               //limited income for single, head of household, widow(er)
const double INCOME_LIMIT2 = 122000;              //limited income for married, filing jointly
const double CUTOFF1 = 10000;                     //Filing status difference cutoff for single, head of household, widow
const double CUTOFF2 = 20000;                     //Filing status difference cutoff for married, filing jointly

int main ()


{
//Variables
     int filingStatus;                            //variable for user to input filing status
     double expenses;                             //user to input qualified expenses
     double tentative1;                           //Tentative Lifetime Learning Credit for expenses <=10000
     double tentative2;                           //Tentative Lifetime Learning Credit - EXPENSE_LIMIT * .20
     double adjustedIncome;                       //user to input adjusted gross income
     float lines1;                                //INCOME_LIMIT1 - adjustedIncome
     float lines2;                                //INCOME_LIMIT2 - adjustedIncome
     float credit1;                               //lines1 / CUTOFF1
     float credit2;                               //lines2 / CUTOFF2


     cout << "Lifetime Learning Credits Worksheet Program" << endl << endl;
     cout << "1 - Single" << endl;
     cout << "2 - Married, Filing Jointly" << endl;
     cout << "3 - Head of Household" << endl;
     cout << "4 - Qualifying Widow(er)" << endl;
     cout << "5 - Married, Filing Separately" << endl << endl;
     cout << "Enter your filing status from above (1-5): ";           
     cin >> filingStatus;                                        //user inputs filing status

     if(filingStatus==5)
    {
          cout << "No Lifetime Learning Credit allowed when filing Married, Filing Separately" << endl;
          cout << "***Enter 0 on form 1040 line 49" << endl << endl;
          return 1;
    }

     cout << "Enter the Amount Qualified Educational Expenses for 2011: ";
     cin >> expenses;                                          //user inputs expenses

     cout << "Please Enter Adjusted Gross Income: ";
     cin >> adjustedIncome;                                //user inputs adjusted gross income
     cout << endl;
//Outputs

     cout << "Lifetime Learning Credits Worksheet" << endl << endl;
     cout << "1. Filing Status: ";                          //depending on user input, outputs filing status

     if(filingStatus==1)
     {
          cout << setw(40) << right << " Single" << endl;
     }

     if(filingStatus==2)
     {
          cout << setw(40) << right << " Married, Filing Jointly" << endl;
     }

     if(filingStatus==3)
     {
          cout << setw(40) << right << " Head of Household" << endl;
     }

     if(filingStatus==4)
     {
          cout << setw(40) << right << " Qualifying Widow" << endl;
     }

//outputs expenses
     cout << "2. Qualified Educational Expenses: " << fixed << setprecision(2) << setw(23) << right << expenses << endl;
     cout << "3. Smaller of line 2 or Expense Limit: ";               //figures smaller amount, line 2 or expense limit

     if(expenses <= 10000)
     {
          cout << fixed << setprecision(2) << setw(19) << right << expenses << endl;
     }

     if(expenses > 10000)
     {
          cout << fixed << setprecision(2) << setw(19) << right << EXPENSE_LIMIT << endl;
     }

     cout << "4. Tentative Lifetime Learning Credit: ";              //figures tentative learning credit
     if(expenses <= 10000)
     {
          tentative1 = expenses * .20;
          cout << fixed << setprecision(2) << setw(19) << tentative1 << endl;
     }

     if(expenses > 10000)
     {
          tentative2 = EXPENSE_LIMIT * .20;
          cout << fixed << setprecision(2) << setw(19) << tentative2 << endl;
     }

     cout << "5. Income Limit: ";                   //depending on user input for filing status, outputs income limit

     if(filingStatus==1)
     {
          cout << fixed << setprecision(2) << setw(41) << right << INCOME_LIMIT1 << endl;
     }

     if(filingStatus==2)
     {
          cout << fixed << setprecision(2) << setw(41) << right << INCOME_LIMIT2 << endl;
     }

     if(filingStatus==3)
     {
          cout << fixed << setprecision(2) << setw(41) << right << INCOME_LIMIT1 << endl;
     }

     if(filingStatus==4)
     {
          cout << fixed << setprecision(2) << setw(41) << right << INCOME_LIMIT1 << endl;
     }

     cout << "6. Adjusted Gross Income: ";                            //outputs adjusted gross income from user input
     cout << fixed << setprecision(2) << setw(32) << right << adjustedIncome << endl;

     //if/else statement below subtracts line 6 from line 5 to determine how much 
     //your income is under the limit. Is the result zero or less?Yes. Skip lines 8 and 9, and display 0 for line 10. 
     //Pause and then Exit the program with exit code 7. (Do not complete the rest of this worksheet).No. Enter 
     //the subtraction result on line 7 and continue.
     if(INCOME_LIMIT1 - adjustedIncome <= 0)                          
     {
          return 7 && 
          cout << endl << "10. Lifetime Learning Credit: " << fixed << setprecision(2) << setw(28) << right << "0.00" << endl << endl << endl << "***Enter amount from worksheet line 10 on form 1040 line 49" << endl;
     }

     else if(INCOME_LIMIT2 - adjustedIncome <= 0)
     {
          return 7 && 
          cout << endl << "10. Lifetime Learning Credit: " << fixed << setprecision(2) << setw(28) << right << "0.00" << endl << endl << endl << "***Enter amount from worksheet line 10 on form 1040 line 49" << endl;
     }

     else if(INCOME_LIMIT1 - adjustedIncome > 0)
     {
          lines1 = INCOME_LIMIT1 - adjustedIncome;
          cout << "7. Line 5 - Line 6: " << fixed << setprecision(2) << setw(38) << right << lines1 << endl;
     }

     else if(INCOME_LIMIT2 - adjustedIncome > 0)
     {
          lines2 = INCOME_LIMIT2 - adjustedIncome;
          cout << "7. Line 5 - Line 6: " << fixed << setprecision(2) << setw(38) << right << lines2 << endl;
     }

     cout << "8. Filing status difference cutoff: ";                  //depending on user filing status, outputs status

     if(filingStatus==1)
     {
          cout << fixed << setprecision(2) << setw(22) << right << CUTOFF1 << endl;
     }

     if(filingStatus==2)
     {
          cout << fixed << setprecision(2) << setw(22) << right << CUTOFF2 << endl;
     }

     if(filingStatus==3)
     {
          cout << fixed << setprecision(2) << setw(22) << right << CUTOFF1 << endl;
     }

     if(filingStatus==4)
     {
          cout << fixed << setprecision(2) << setw(22) << right << CUTOFF1 << endl;
     }


     if(lines1 >= CUTOFF1)
     {
       cout << "9. Portion of tentative credit allowed: " << fixed << setprecision(2) << setw(18) << right << "1.0" << endl;
     }

     else if(lines1 < CUTOFF1)
     {
       credit1 = lines1 / CUTOFF1;
       cout << "9. Portion of tentative credit allowed: " << fixed << setprecision(3) << setw(18) << right << credit1 << endl; 
     }


     else if(lines2 >= CUTOFF2)
     {
       cout << "9. Portion of tentative credit allowed: " << fixed << setprecision(2) << setw(18) << right << "1.0" << endl;
     }

     else if(lines2 < CUTOFF2)
     {
       credit2 = lines2 / CUTOFF2;
       cout << "9. Portion of tentative credit allowed: " << fixed << setprecision(3) << setw(18) << right << credit2 << endl;
     }

     cout << "10. Lifetime Learning Credit:";                    //need help with this line

     cout << endl << endl;
system ("PAUSE");
return 0;
}

Recommended Answers

All 3 Replies

Again 'Need Help ASAP' is not a good title.

Many of us ignore any posts with URGENT or ASAP. They indicate to us posters that think their problems are more wothy of help than others, and, to us, there is no urgency at all.

But aside from that (don't do it again) you need to ask better questions. You ask:

I was supposed to do a function for line 9:

The function shall take two input arguments:
the line 7 amount and the line 8 amount.
o The function will test if line 7 is equal to or more than line 8, and then compute
the correct results for line 9.

Well, line 9 is const double CUTOFF1 = 10000;. There is no possible way to convert that into a function.

Remember, we don't know your project so you must explain what you really need in terms of the code you have, not the unspecified project directions

Line 10 is supposed to be:

Multiply line 4 by line 9 and enter result on line 10.

Line 4 is using namespace std; .

The function will test if line 7 is equal to or more than line 8, and then compute
the correct results for line 9. The function will return the floating point result.

How does it calculate ? What is the formula ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.