Click here to Skip to main content
15,908,013 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ok, this is a wadge caculation that uses a class to create the functions.

I got this far but it keeps saying end of file found before return.
I can not see the problem any help here would be appreciated.

#include <iostream>
#include <string>
using namespace std;
class employee {
private:
	const static int MAX_HOURS = 40 ;
	string firstName;
	string lastName;
	int hours[MAX_HOURS];
	int numhours;
	int wadges;
public:
	// First Name
	string getFirstName() { return firstName; }
	void setFirstName(string name) { firstName = name; }
	void retrieveFirstName() {
		string emp;
		cout << "First Name: ";
		cin >> emp;
		setFirstName(emp);
	}
	// Last Name
	string getLastName() { return lastName;	}
	void setLastName(string name) {	lastName = name; }
	void retrieveLastName() {
		string emp;
		cout << "Last Name: ";
		cin >> emp;
		setLastName(emp);
	}
	// Num hours
	int getnumhours() { return numhours; }
	void setnumhours(int hours) {
		if (hours >= 0 && hours <= MAX_HOURS) {
			numhours = hours;
		} else { 
			numhours = 0;
		}
	}
	void retrievenumhours() {
		cout << "How many hours did you work? ";
		int thours;
		cin >> thours;
		setnumhours(thours);
	}
		
	
  // Wadges
	int getwadges() {return wadges;}
	void setwadges (int twadges){
		wadges = twadges;
	setwadges(twadges);
	}
	void retrievewadges() {
		cout << "Wadges per hour ? ";
		int wadges;
		cin >> wadges;
		setwadges(wadges);
	}
	void retrieve() {
		retrieveFirstName();
		retrieveLastName();
		retrievenumhours();
		retrievewadges();
	}
	double calwadges() {
	double total = 0;
	for (int i = 0; i < getnumhours(); i ++) {
	total += hours[i];
	
	
	
	
	
};

int main() {
	employee name ;
	name.retrieve();


	system("pause");
	return 0;
}
Posted
Updated 16-Nov-10 21:38pm
v3
Comments
Dalek Dave 17-Nov-10 3:38am    
Minor Edit for Grammar.

You forgot to "close" (with a '}' character) the calwadge function at the end of your class.
 
Share this answer
 
Comments
[no name] 17-Nov-10 2:27am    
If end of file found, then you must include precompiled header (stdafx.h) (if it is cpp file and asks to include it) or count '{' and '}'.
Dalek Dave 17-Nov-10 3:38am    
Good Call.
check with your last for loop. you missed a } there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900