You are on page 1of 2

Assignment 5: Handling Arrays Due Date: March 31, 2010.

Store the following information using arrays. The second column refers to person-id and the last column indicates the number of hours put in by the various individuals. MUKUND HARI AMRITA JAGDISH CHAUDHRI GYAN 2345 1940 4178 3299 1122 2244 10.5 9.23 7.77 5.55 4.44 6.66

Store the information using arrays. First of all make a copy of the arrays in the main program, as you will be using the original arrays in all the parts mentioned below. When you make the copies make sure that the original and the copied arrays are identical by printing out both the arrays. Later you block these print statements by making them comment statements. Your final submitted assignment should NOT show the results of these print statements. The TAs would be testing your program with different arrays, so make sure that your program can handle any number of persons (max size 10). 1. Write a function which accepts a given name and prints the name followed by number of characters in the name, e.g. MUKUND (6). Do not use the strlen function. Call the function repeatedly from the main program and print all the names in this manner. 2. Write a function which accepts the arrays and changes the number of hours by adding 2.0 to each value. Inside the main program print person-id and changed hours for all the persons, in the order shown above. 3. Write a function which accepts the arrays and prints out the name of the person with the smallest number of hours. 4. Write a function which accepts the arrays and prints person-id and names in increasing order of person-id.

Your assignment output should appear in the following format with a heading for each part: PART 1 XXXXXXXXXXXXX ______________________________________________________________ PART 2 XXXXXXXXXXXXX ______________________________________________________________ PART 3 XXXXXXXXXXXXX ____________________________________________________________ PART 4 XXXXXXXXXXXXX

You might also like