Reynolds773's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
23 (0.03 per day)
Joined:
29-October 12
Profile Views:
268
Last Active:
User is offline Dec 05 2012 12:57 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Subaru
Dream Kudos:
0
Icon   Reynolds773 has not set their status

Posts I've Made

  1. In Topic: Need help using Arrays in function prototypes and definitions

    Posted 5 Dec 2012

    I had to turn it in unfortunately :/ I will take a look at it tomorrow though so I can say I finished it.
  2. In Topic: Need help using Arrays in function prototypes and definitions

    Posted 4 Dec 2012

    Ehhh, I've run into more problems. I'm stuck on the GetTotalWages function. I have to find the average wage which is (total/count), so either count or total is incorrect. Here is my code for that function.

    EDIT: I now see that I have "double totalWages = 0;" How can I initialize that without it being a pass by reference?

    Prototype:
    double GetTotalWages(double employeeWages[], int);
    



    Function Definition:
    /*  TODO (STEP 2):  Define GetTotalWages function
    
        Function to find the sum of wages for employees.
    
        Parameters:
            in: empWages    array containing wages type double
            in: count       integer count of how many array elements to sum
        Precondition:
            empWages contains values for employees who have been assigned wages.
            count is >= 0 AND <= size of array
        Postcondition:
            returns a double value for sum of count wages
    */
    	double GetTotalWages(double employeeWages[], int count)
    	{
    		double totalWages = 0;
    
    		for(count = 0; count <= 5; count++)
    		{
    			totalWages += employeeWages[count];
    		}
    
    		return totalWages;
    	}
    



    My sad output :(/>

    Enter wages for employee 1001: 10

    Another (y or n): y
    Enter wages for employee 1002: 20.50

    Another (y or n): y
    Enter wages for employee 1003: 15.25

    Another (y or n): y
    Enter wages for employee 1004: 24.10

    Another (y or n): y
    Enter wages for employee 1005: 9.95

    ID Wage

    Average Wage: 0.00

    Largest wage found is $0.00
    Smallest wage found is for employee 1001: $-925596313493178300000000000000000000
    00000000000000000000000000.00

    End Program - Press any key to continue . . .
  3. In Topic: Need help using Arrays in function prototypes and definitions

    Posted 4 Dec 2012

    It's okay! I'm at work now, so I'll take a look at your suggestion when I get home. Thanks in advance!
  4. In Topic: Need help using Arrays in function prototypes and definitions

    Posted 4 Dec 2012

    Yes, I can see how that works, but I'm not sure that helps my situation. I have to make the program display the ID number for each employee when I enter their wage

    Like so:

    /*Enter wages for employee 1001: 10
    
    Another (y or n): y
    Enter wages for employee 1002: 20.50
    
    Another (y or n): y
    Enter wages for employee 1003: 15.25
    
    Another (y or n): y
    Enter wages for employee 1004: 24.10
    
    Another (y or n): y
    Enter wages for employee 1005: 9.95*/
    
  5. In Topic: Need help using Arrays in function prototypes and definitions

    Posted 4 Dec 2012

    How can I get the function to print the employee ID without referencing which position in the parameter? This is where I'm confused.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Programming Languages:
Java, C++

Contact Information

E-mail:
Private

Friends

Reynolds773 hasn't added any friends yet.

Comments

Page 1 of 1
  1. Photo

    hockeyplayer02 Icon

    12 Aug 2014 - 12:13
    Can you please delete your post at http://www.dreamincode.net/forums/topic/297708-help-with-reading-lowest-integer-from-a-file/page__p__1733897&#entry1733897 I am a professor and that is the solution to one of my tests.
Page 1 of 1