>>// Lab 4 read and calculation file/input Ray Perales
>>// This program will read the data in the input file
>>// used by grosspayMinustaxFileCode
>>

>>#include <iostream>
>>#include <fstream>
>>using namespace std;
>>
>>int main()
>>
>{
>> 	ifstream fin;
>> 	fin.open("readgrosspayMinustax.in");
>> 	if (fin.fail())
>> {
>> 	cerr << "error opening input file.\n\n"; 
>> 	system("pause");
>> 	exit(1);
>> }
>> 	

                int employee = 1;
>> 	int exemptions, taxbracket, inputValue;
>> 	double hours, payrate, overtime = 0.0, grosspay, netpay, rate, tax;
>>
>>     // cout << "Enter an integer: ";                    	//DO U NEED THE //
>> 	fin >> hours;
                fin >> payrate;
>> 	while (cin >> hours) 
>> {	                                   //DO I NEED TO INSERT HERE:
                                                   //COUT<<”ENTER YOUR PAYRATE: “;
                                                   //PAYRATE = NUMBER

				

					
>> 	if (hours > 40)                  //IF HOURS ARE GREATER THAN 40
>> 	overtime = hours - 40;      //TAKE LETS SAY 43 – 40 AND ASSIGN TO OT
>> 	hours = 40;                     //HERE IT LOOKS LIKE IM TAKING 40 N ASGN TO HRS
>> 			      //BECAUSE IT WILL ALWAYS BE 40? CAN BE LESS??
grosspay = hours * payrate + overtime * payrate * 1.5;
>> }
>> 	fin >> inputValue;
>> {	
	if (taxbracket == 1)
>> 	rate = .13;
>> 	else if (taxbracket == 2)
>> 	rate = .27;
>> 	else if (taxbracket == 3)
>> 	rate = .35;
>> }
>> 	fin >> inputValue;
>> {
>> 	tax = grosspay * (rate - .01 * exemptions);  //WHERE R THE EXEMPTIONS 
>> 	netpay = grosspay - tax;		//COMING FROM??
>> }
>> 	cout << employee << hours << payrate << endl;
>> 	cout << taxbracket << exemptions << endl;
>> 	cout << grosspay << tax << netpay;


>>
>> 	fin.close();
>> 	system("pause");
>> 	return 0;
>>}

Here's your code with the extra characters removed, formatted, and with code tags. To add code tags, do this:

[code=cplusplus] // paste code here

[/code]
or

[code]

// paste code here

[/code]

The first way adds line numbers and C++ syntax highlighting. The second does not.

What is this program supposed to do? I can guess, and you've commented where you are stuck, but please provide an explanation. Your questions will be easier to answer if we know the program specifications. You may also want to provide the input file or at least describe the input file.

// Lab 4 read and calculation file/input Ray Perales
// This program will read the data in the input file
// used by grosspayMinustaxFileCode

#include <iostream>
#include <fstream>
using namespace std;

int main()

{
    ifstream fin;
    fin.open("readgrosspayMinustax.in");
    if (fin.fail())
    {
        cerr << "error opening input file.\n\n";
        system("pause");
        exit(1);
    }


    int employee = 1;
    int exemptions, taxbracket, inputValue;
    double hours, payrate, overtime = 0.0, grosspay, netpay, rate, tax;

    // cout << "Enter an integer: "; //DO U NEED THE //
    fin >> hours;
    fin >> payrate;
    while (cin >> hours)
    { 
        //DO I NEED TO INSERT HERE:
        //COUT<<”ENTER YOUR PAYRATE: “;
        //PAYRATE = NUMBER




        if (hours > 40) //IF HOURS ARE GREATER THAN 40
            overtime = hours - 40; //TAKE LETS SAY 43 – 40 AND ASSIGN TO OT
        hours = 40; //HERE IT LOOKS LIKE IM TAKING 40 N ASGN TO HRS
        //BECAUSE IT WILL ALWAYS BE 40? CAN BE LESS??
        grosspay = hours * payrate + overtime * payrate * 1.5;
    }
    fin >> inputValue;
    {
        if (taxbracket == 1)
            rate = .13;
        else if (taxbracket == 2)
            rate = .27;
        else if (taxbracket == 3)
            rate = .35;
    }
    fin >> inputValue;
    {
        tax = grosspay * (rate - .01 * exemptions); //WHERE R THE EXEMPTIONS
        netpay = grosspay - tax; //COMING FROM??
    }
    cout << employee << hours << payrate << endl;
    cout << taxbracket << exemptions << endl;
    cout << grosspay << tax << netpay;

    fin.close();
    system("pause");
    return 0;
}

yes that dose Thank you

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.