amyceres's Profile
Reputation: 0
Apprentice
- Group:
- Active Members
- Active Posts:
- 67 (0.27 per day)
- Joined:
- 11-October 12
- Profile Views:
- 139
- Last Active:
Dec 18 2012 06:17 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Problem with Departments and Professors...
Posted 18 Dec 2012
-
In Topic: Problem with Departments and Professors...
Posted 18 Dec 2012
I going to have to do a separate function for this...I think -
In Topic: Problem with Departments and Professors...
Posted 18 Dec 2012
void Department::Display_Total_Salary() { float sum=0; if (isEmpty()) cout<<"The list is empty\n"; while (curr) { node *curr=List.head; sum=sum+curr->salary; curr=curr->next; } return sum; }
else if(in==5) { cout<<"Total Salary of all departments listed would be "<<One.Display_Total_Salary()+Two.Display_Total_Salary()+Three.Display_Total_Salary()<<endl; }
I think this should work....hopefully it's correct me if I am wrong... -
In Topic: Problem with Departments and Professors...
Posted 18 Dec 2012
How about this? where would I put this?
double totalsalary() { double sum=0; while(curr) node*curr =List.head; sum=sum+curr->salary; curr=curr->next; } return sum;
I was thinking of replacing the void Department::Display_Total_Salary()
with
void Department::totalSalary(double)
else if(in==5) { cout<<"Total Salary of all departments listed would be "<<One.totalSalary()+Two.totalSalary()+Three.totalSalary()<<endl; } -
In Topic: Problem with Departments and Professors...
Posted 18 Dec 2012
jimblumberg, on 18 December 2012 - 07:53 AM, said:This would be much easier if you were using a vector, or an array of your Department class.
Please explain what you are trying to accomplish with this line:
One+Two+Three.Display_Total_Salary();
Jim
I am trying to add the departments' employees' salaries together...vs. having to ask which department you want to see the salary for.
In the menu I had for in==5
cout<<"5. Display Total Salary for All Employees\n";
My Information
- Member Title:
- D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Click here to e-mail me
Friends
amyceres hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
amyceres has no profile comments yet. Why not say hello?