Structures Lesson CS1313 Spring 2009 1 Structures Lesson Outline 1.Structures Lesson Outline 2.Beyond Arrays 3.A Company and Its Employees #1 4.A Company.

Slides:



Advertisements
Similar presentations
Pointer Lesson 2 CS1313 Spring Pointer Lesson 2 Outline 1.Pointer Lesson 2 Outline 2.Pass by Reference Bad Example 3.Pass by Reference Good Example.
Advertisements

CS 11 C track: lecture 7 Last week: structs, typedef, linked lists This week: hash tables more on the C preprocessor extern const.
Standard I/O Lesson Outline
Standard I/O Lesson CS1313 Spring Standard I/O Lesson Outline 1.Standard I/O Lesson Outline 2.Output via printf 3.Placeholders 4.Placeholders for.
Programming and Data Structure
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
Pointers & Dynamic Memory Allocation Mugurel Ionu Andreica Spring 2012.
Arithmetic Expressions Lesson #1 CS1313 Spring Arithmetic Expressions Lesson #1 Outline 1.Arithmetic Expressions Lesson #1 Outline 2.A Less Simple.
Structures. An array allows us to store a collection of variables However, the variables must be of the same type to be stored in an array E.g. if we.
File I/O Lesson CS1313 Spring File I/O Lesson Outline 1.File I/O Lesson Outline 2.File I/O Using Redirection #1 3.File I/O Using Redirection #2.
Enumerated Types 4 Besides the built-in types, ANSI C allows the definition of user-defined enumerated types –To define a user-define type, you must give.
Functions Definition: Instruction block called by name Good design: Each function should perform one task and do it well Functions are the basic building.
Introduction to C Programming CE Lecture 10 Data Structures typedef and struct.
User Defined Functions Lesson 2 CS1313 Spring User Defined Functions 2 Outline 1.User Defined Functions 2 Outline 2.Argument Order When Passing.
For Loop Lesson 3 CS1313 Spring for Loop Lesson 3 Outline 1. for Loop Lesson 3 Outline 2. for Loop with a float Counter: BAD! 3. float Counter Example.
Lecture No: 16. The scanf() function In C programming language, the scanf() function is used to read information from standard input device (keyboard).
Characters & Strings Lesson 2 CS1313 Spring Characters & Strings Lesson 2 Outline 1.Characters & Strings Lesson 2 Outline 2.Character String Declaration.
Pointer Lesson 1 CS1313 Spring Pointer Lesson 1 Outline 1.Pointer Lesson 1 Outline 2.A Pointer Experiment 3.Point! 4.What is a Pointer? 5. NULL.
LECTURE 4: INFORMATION REPRESENTATION (PART II) COMP26120: ALGORITHMS AND IMPERATIVE PROGRAMMING.
Array Lesson 1 CS1313 Spring Array Lesson 1 Outline 1.Array Lesson 1 Outline 2.Mean of a List of Numbers 3.mean: Declarations 4.mean: Greeting,
Pointers CS362. Pointers A Pointer is a variable that can hold a memory address Pointers can be used to: Indirectly reference existing variables (sometimes.
C Programming Tutorial – Part I CS Introduction to Operating Systems.
Numeric Data Types Lesson CS1313 Spring Numeric Data Types Outline 1.Numeric Data Types Outline 2.Data Types 3.Integers in Mathematics 4.Integers.
Array Lesson 2 CS1313 Spring Array Lesson 2 Outline 1.Array Lesson 2 Outline 2.Reading Array Values Using for Loop #1 3.Reading Array Values Using.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
1 Pointers and Arrays. 2 When an array is declared,  The compiler allocates sufficient amount of storage to contain all the elements of the array in.
For Loop Lesson 1 CS1313 Spring for Loop Lesson 1 Outline 1. for Loop Lesson 1 Outline 2.A while Loop That Counts #1 3.A while Loop That Counts.
Arrays  Array is a collection of same type elements under the same variable identifier referenced by index number.  Arrays are widely used within programming.
Pointers: Basics. 2 What is a pointer? First of all, it is a variable, just like other variables you studied  So it has type, storage etc. Difference:
CS 108 Computing Fundamentals April 7, GHP # 10 and GHP 11 GHP 10 will be posted later today ­ Due: Saturday, April 11, at midnight GHP 11 will.
CS 31 Discussion, Week 8 Faisal Alquaddoomi, Office Hours: BH 2432, W 4:30-6:30pm, F 12:00-1:00pm.
Spring 2005, Gülcihan Özdemir Dağ Lecture 6, Page 1 BIL104E: Introduction to Scientific and Engineering Computing, Spring Lecture 6 Outline 6.1Introduction.
Spring 2005, Gülcihan Özdemir Dağ Lecture 11, Page 1 BIL104E: Introduction to Scientific and Engineering Computing, Spring Lecture 11 Outline 11.1.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
 Structures are like arrays except that they allow many variables of different types grouped together under the same name. For example you can create.
Variables & Constants Lesson 2 Outline
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 13: Data structures in C.
Boolean Data Lesson CS1313 Fall Boolean Data Outline 1.Boolean Data Outline 2.Data Types 3.C Boolean Data Type: char or int 4.C Built-In Boolean.
1 CSC103: Introduction to Computer and Programming Lecture No 24.
User Defined Functions Lesson 1 CS1313 Spring User Defined Functions 1 Outline 1.User Defined Functions 1 Outline 2.Standard Library Not Enough.
Computer And Programming Array and Pointer. Array provides a means to allocating and accessing memory. Pointers, on the other hand, provides a way to.
Structures. Outline Introduction Structure Definitions and declarations Initializing Structures Operations on Structures members Structures as Functions.
Chapter 8 Arrays. A First Book of ANSI C, Fourth Edition2 Introduction Atomic variable: variable whose value cannot be further subdivided into a built-in.
Pointers in C++. Topics Covered  Introduction to Pointers  Pointers and arrays  Character Pointers, Arrays and Strings  Examples.
Arrays as pointers and other stuff COP3275 – PROGRAMMING USING C DIEGO J. RIVERA-GUTIERREZ.
1 CS161 Introduction to Computer Science Topic #15.
CS1313: Arithmetic Expressions Lesson #2 CS1313 Spring Arithmetic Expressions Lesson #2 Outline 1.Arithmetic Expressions Lesson #2 Outline 2.Named.
1 Pointers: Parameter Passing and Return. 2 Passing Pointers to a Function Pointers are often passed to a function as arguments  Allows data items within.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 11: Pointers.
1 11/30/05CS150 Introduction to Computer Science 1 Structs.
Arrays C provides the option to the user to combine similar data types into a single entity It followed contiguous memory allocation.
Array and Pointers An Introduction Unit Unit Introduction This unit covers the usage of pointers and arrays in C++
13/10/2016CS150 Introduction to Computer Science 1 Multidimensional Arrays  Arrays can have more than one column  Two dimensional arrays have two columns.
Lecture 10: Structures. Outline Introduction Structure Definitions and declarations Initializing Structures Operations on Structures members Structures.
C Tutorial - Pointers CS 537 – Introduction to Operating Systems.
Introduction to programming in java Lecture 21 Arrays – Part 1.
Arrays An array is a sequence of objects all of which have the same type. The objects are called the elements of the array and are numbered consecutively.
Pointers: Basics. 2 Address vs. Value Each memory cell has an address associated with it
Boolean Data Lesson #1 Outline
Character Strings Lesson Outline
Numeric Data Types Outline
Boolean Data Lesson #1 Outline
Array Lesson 1 Outline Array Lesson 1 Array Lesson 1 Outline
User Defined Functions 2 Outline
Strings A collection of characters taken as a set:
Lecture 18 Arrays and Pointer Arithmetic
for Loop Lesson 3 Outline
Arithmetic Expressions Lesson #2 Outline
Variables Lesson Outline
Arithmetic Expressions Lesson #1 Outline
Presentation transcript:

Structures Lesson CS1313 Spring Structures Lesson Outline 1.Structures Lesson Outline 2.Beyond Arrays 3.A Company and Its Employees #1 4.A Company and Its Employees #2 5.Multiple Employees #1 6.Multiple Employees #2 7.Multiple Employees #3 8.A New Data Type #1 9.A New Data Type #2 10.A New Data Type #3 11.Structure Definition Breakdown 12.Structure Instance Declaration #1 13.Structure Instance Declaration #2 14.Structure Instance Declaration #3 15.Structure Instance Declaration #4 16.Fields of a Structure Instance #1 17.Fields of a Structure Instance #2 18.Fields of a Structure Instance #3 19.Fields of a Structure Instance #4 20.Structure Fields Like Array Elements #1 21.Structure Fields Like Array Elements #2 22.Structure Example #1 23.Structure Example #2 24.Structure Example #3 25.Structure Example #4 26.Structure Example #5 27.Structure Array 28.Structure Array: Static vs Dynamic 29.Structure Array: Dynamic Allocation 30.Structure Array: Indexing 31.Structure Array: Element’s Field Access 32.Structure Array Example #1 33.Structure Array Example #2 34.Structure Array Example #3 35.Structure Array Example #4 36.Structure Array Example #5 37.Structure Array Example #6 38.Structure Array Example #7 39.Structure Array Example #8 40.Structure Array Example #9

Structures Lesson CS1313 Spring Beyond Arrays An array is a collection of values, all of which have the same data type, and all of which have the same essential meaning: float* independent_variable = (float*)NULL; In memory, the elements of the array are contiguous: they occur one after the other in memory. What if, instead of having a collection of data that all have the same data type and meaning, we had a collection of data that had different data types and different meanings?

Structures Lesson CS1313 Spring A Company and Its Employees #1 Suppose that we work for the Depressingly Dull Corporation (DDC), and our boss tells us to write a program that tracks DDC’s employees. What data will we need? Well, we’ll probably need to know things like: first name; last name; pay rate; number of hours worked this week; social security number. How could we implement this in C?

Structures Lesson CS1313 Spring A Company and Its Employees #2 How could we implement this in C? Well, we could simply set up a scalar variable to represent each of these values (and strings for the names): char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; Of course, this arrangement would work if our company had exactly one employee. But what if our company has multiple employees?

Structures Lesson CS1313 Spring Multiple Employees #1 Okay, so suppose that DDC has multiple employees. How could we store the data for them? Well, we could have an array for each of the pieces of data: char* first_name[number_of_employees]; char* last_name[number_of_employees]; float pay_rate[number_of_employees]; float hours_worked_this_week[number_of_employees]; int social_security_number[number_of_employees];

Structures Lesson CS1313 Spring Multiple Employees #2 char* first_name[number_of_employees]; char* last_name[number_of_employees]; float pay_rate[number_of_employees]; float hours_worked_this_week[number_of_employees]; int social_security_number[number_of_employees]; This approach will work fine, but it’ll be unwieldy to work with. Why? Because it doesn’t match the way that we think about our employees. That is, we don’t think of having several first names, several last names, several social security numbers and so on; we have several employees.

Structures Lesson CS1313 Spring Multiple Employees #3 We don’t think of having several first names, several last names, several social security numbers and so on. Instead, we think of having several employees, each of whom has a first name, a last name, a social security number, etc. In general, it’s much easier to write a program if we can write it in a way that matches the way we think as much as possible. So: What if we could create a new data type, named Employee, that represented an employee?

Structures Lesson CS1313 Spring A New Data Type #1 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; The above declaration creates a new data type, named Employee. This is known as a user-defined data type or a user-defined data structure.

Structures Lesson CS1313 Spring A New Data Type #2 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; The user-defined data type Employee consists of: a character string, first_name ; a character string, last_name ; a float scalar, pay_rate ; a float scalar, hours_worked_this_week ; an int scalar, social_security_number.

Structures Lesson CS1313 Spring A New Data Type #3 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; In C, this construct is referred to as a structure definition, and (surprise!) it defines a structure. The general term for this is a user-defined data type. NOTE: A structure definition, as above, only defines the new data type; it DOESN’T DECLARE any actual instances of data of the new data type.

Structures Lesson CS1313 Spring Structure Definition Breakdown typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; A structure definition consists of: a typedef struct statement and block open { ; a sequence of field definitions, which tell us the pieces of data that constitute an instance of the structure; a block close } and the name of the structure, followed by a statement terminator.

Structures Lesson CS1313 Spring Structure Instance Declaration #1 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; The above struct definition defines the struct named Employee, but DOESN’T DECLARE any instance of data whose data type is Employee.

Structures Lesson CS1313 Spring Structure Instance Declaration #2 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; To declare an instance of an Employee, we need to do like so: Employee worker_bee;

Structures Lesson CS1313 Spring Structure Instance Declaration #3 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; Employee worker_bee; The last statement above declares that worker_bee is an instance of type Employee ; it tells the compiler to grab a group of bytes, name them worker_bee, and think of them as storing an Employee.

Structures Lesson CS1313 Spring Structure Instance Declaration #4 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; Employee worker_bee; How many bytes? That depends on the platform and the compiler, but the short answer is that it’s the sum of the sizes of the fields.

Structures Lesson CS1313 Spring Fields of a Structure Instance #1 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; Employee worker_bee; Okay, so now we have an instance of data type Employee named worker_bee. But how can we use the values of its field data? For example, how do we get the social security number of worker_bee ?

Structures Lesson CS1313 Spring Fields of a Structure Instance #2 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; Employee worker_bee; To use an individual field of a struct, we use the field operator, which is the period: worker_bee.social_security_number

Structures Lesson CS1313 Spring Fields of a Structure Instance #3 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; Employee worker_bee; For example, we can assign a value to the social security number of worker_bee : worker_bee.social_security_number = ; This is equivalent to using an index in an array: independent_variable[element] = ;

Structures Lesson CS1313 Spring Fields of a Structure Instance #4 typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; Employee worker_bee; Likewise, we can output the social security number of worker_bee : printf("%d\n", worker_bee.social_security_number); This is equivalent to using an index in an array: printf("%d\n", independent_variable[element]);

Structures Lesson CS1313 Spring Structure Fields Like Array Elements #1 We said that we can use the field operator (period) to get an individual field of an instance of a struct : worker_bee.social_security_number = ; printf("%d\n", worker_bee.social_security_number); Notice that this usage is analogous to the use of an index with an array: independent_variable[element] = ; printf("%d\n", independent_variable[element]);

Structures Lesson CS1313 Spring Structure Fields Like Array Elements #2 In the case of arrays, we said that an individual element of an array behaves exactly like a scalar of the same data type. Likewise, a field of a struct behaves exactly like a variable of the same data type as the field. So, worker_bee.social_security_number can be used exactly like an int scalar, and worker_bee.first_name can be used exactly like a character string.

Structures Lesson CS1313 Spring Structure Example #1 #include int main () { /* main */ typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; const int maximum_name_length = 32; Employee worker_bee; char dummy_name[maximum_name_length + 1]; float worker_bee_pay;

Structures Lesson CS1313 Spring Structure Example #2 printf("What is the first name of the employee?\n"); fgets(dummy_name, maximum_name_length, stdin); if (dummy_name[strlen(dummy_name)-1] == ’\n’) { dummy_name[strlen(dummy_name)-1] = ’\0’; } /* if (dummy_name[strlen(dummy_name)-1]==’\n’) */ worker_bee.first_name = (char*)malloc(sizeof(char) * (strlen(dummy_name) + 1)); strcpy(worker_bee.first_name, dummy_name); printf("What is the last name of the employee?\n"); fgets(dummy_name, maximum_name_length, stdin); if (dummy_name[strlen(dummy_name)-1] == ’\n’) { dummy_name[strlen(dummy_name)-1] = ’\0’; } /* if (dummy_name[strlen(dummy_name)-1]==’\n’) */ worker_bee.last_name = (char*)malloc(sizeof(char) * (strlen(dummy_name) + 1)); Huh?

Structures Lesson CS1313 Spring Structure Example #3 strcpy(worker_bee.last_name, dummy_name); printf("What is %s %s’s pay rate in $/hour?\n", worker_bee.first_name, worker_bee.last_name); scanf("%f", &worker_bee.pay_rate); printf("How many hours did %s %s work this week?\n", worker_bee.first_name, worker_bee.last_name); scanf("%f", &worker_bee.hours_worked_this_week); printf("What is %s %s’s social security number?\n", worker_bee.first_name, worker_bee.last_name); scanf("%d", &worker_bee.social_security_number);

Structures Lesson CS1313 Spring Structure Example #4 worker_bee_pay = worker_bee.pay_rate * worker_bee.hours_worked_this_week; printf("Employee %s %s (%9.9d)\n", worker_bee.first_name, worker_bee.last_name, worker_bee.social_security_number); printf(" worked %2.2f hours this week\n", worker_bee.hours_worked_this_week); printf(" at a rate of $%2.2f per hour,\n", worker_bee.pay_rate); printf(" earning $%2.2f.\n", worker_bee_pay); } /* main */

Structures Lesson CS1313 Spring Structure Example #5 % gcc -o employee_test employee_test.c % employee_test What is the first name of the employee? Henry What is the last name of the employee? Neeman What is Henry Neeman’s pay rate in $/hour? 12.5 How many hours did Henry Neeman work this week? What is Henry Neeman’s social security number? Employee Henry Neeman ( ) worked hours this week at a rate of $12.50 per hour, earning $

Structures Lesson CS1313 Spring Structure Array When we started working on this task, we wanted to work out a convenient way to store the many employees of the Depressingly Dull Corporation (DDC). So far, we’ve worked out how to defined a structure, how to declare an individual instance of the struct, and how to use the fields of the instance. So, how would we declare and use an array of instances of a struct ? Employee worker_bee_array[maximum_employees];

Structures Lesson CS1313 Spring Structure Array: Static vs Dynamic Employee worker_bee_array[maximum_employees]; Not surprisingly, an array whose elements are a struct can either be declared to be statically allocated (above) or dynamically allocatable (below): Employee* worker_bee_array2 = (Employee*)NULL;

Structures Lesson CS1313 Spring Structure Array: Dynamic Allocation Employee* worker_bee_array2 = (Employee*)NULL; If a struct array is declared to be dynamically allocatable, then allocating it looks just like allocating an array of a scalar data type: worker_bee_array2 = (Employee*)malloc(sizeof(Employee) * number_of_employees);

Structures Lesson CS1313 Spring Structure Array: Indexing An individual element of an array of some struct data type can be accessed using indexing, exactly as if it were an element of an array of scalar data type: worker_bee_array[index]

Structures Lesson CS1313 Spring Structure Array: Element’s Field Access Fields of an individual element of an array of a struct data type can be accessed thus: worker_bee_array[index].pay_rate For example: worker_bee_array[index].pay_rate = 6.50; printf("%f\n", worker_bee_array[index].pay_rate);

Structures Lesson CS1313 Spring Structure Array Example #1 #include int main () { /* main */ typedef struct { char* first_name; char* last_name; float pay_rate; float hours_worked_this_week; int social_security_number; } Employee; const int maximum_name_length = 32; const int error_exit_code = -1; Employee* worker_bee = (Employee*)NULL; float* worker_bee_pay = (float*)NULL; char dummy_name[maximum_name_length + 1]; int number_of_worker_bees, index;

Structures Lesson CS1313 Spring Structure Array Example #2 printf("How many employees does the company have?\n"); scanf("%d", &number_of_worker_bees); worker_bee = (Employee*)malloc(sizeof(Employee) * number_of_worker_bees); if (worker_bee == (Employee*)NULL) { printf("ERROR: can’t allocate worker_bee array "); printf("of length %d Employees\n", number_of_worker_bees); exit(error_exit_code); } /* if (worker_bee == (Employee*)NULL) */ worker_bee_pay = (float*)malloc(sizeof(float) * number_of_worker_bees); if (worker_bee == (float*)NULL) { printf("ERROR: can’t allocate worker_bee_pay "); printf("array of length %d floats", number_of_worker_bees); exit(error_exit_code); } /* if (worker_bee_array == (float*)NULL) */

Structures Lesson CS1313 Spring Structure Array Example #3 for (index = 0; index < number_of_worker_bees; index++) { /* I DO NOT UNDERSTAND WHY THIS IS NEEDED! */ getchar(); printf("What is the first name of "); printf("employee #%d?\n", index); fgets(dummy_name, maximum_name_length, stdin); if (dummy_name[strlen(dummy_name)-1] == ’\n’) { dummy_name[strlen(dummy_name)-1] = ’\0’; } /* if (dummy_name[strlen(dummy_name)-1]...) */ worker_bee[index].first_name = (char*)malloc(sizeof(char) * (strlen(dummy_name) + 1)); strcpy(worker_bee[index].first_name, dummy_name);

Structures Lesson CS1313 Spring Structure Array Example #4 printf("What is the last name of "); printf("employee #%d?\n", index); fgets(dummy_name, maximum_name_length, stdin); if (dummy_name[strlen(dummy_name)-1] == ’\n’) { dummy_name[strlen(dummy_name)-1] = ’\0’; } /* if (dummy_name[strlen(dummy_name)-1]...) */ worker_bee[index].last_name = (char*)malloc(sizeof(char) * (strlen(dummy_name) + 1)); strcpy(worker_bee[index].last_name, dummy_name);

Structures Lesson CS1313 Spring Structure Array Example #5 printf("What is %s %s’s pay rate in $/hour?\n", worker_bee[index].first_name, worker_bee[index].last_name); scanf("%f", &worker_bee[index].pay_rate); printf("How many hours did %s %s work ", worker_bee[index].first_name, worker_bee[index].last_name); printf("this week?\n"); scanf("%f", &worker_bee[index].hours_worked_this_week); printf("What is %s %s’s ", worker_bee[index].first_name, worker_bee[index].last_name); printf("social security number?\n"); scanf("%d", &worker_bee[index].social_security_number); } /* for index */

Structures Lesson CS1313 Spring Structure Array Example #6 for (index = 0; index < number_of_worker_bees; index++) { worker_bee_pay[index] = worker_bee[index].pay_rate * worker_bee[index].hours_worked_this_week; } /* for index */

Structures Lesson CS1313 Spring Structure Array Example #7 for (index = 0; index < number_of_worker_bees; index++) { printf("Employee %s %s (%9.9d)\n", worker_bee[index].first_name, worker_bee[index].last_name, worker_bee[index].social_security_number); printf(" worked %2.2f hours this week\n", worker_bee[index].hours_worked_this_week); printf(" at a rate of $%2.2f per hour,\n", worker_bee[index].pay_rate); printf(" earning $%2.2f.\n", worker_bee_pay[index]); } /* for index */ } /* main */

Structures Lesson CS1313 Spring Structure Array Example #8 % gcc -o employee_array_test employee_array_test.c % employee_array_test How many employees does the company have? 2 What is the first name of employee #0? Henry What is the last name of the employee #0? Neeman What is Henry Neeman’s pay rate in $/hour? 12.5 How many hours did Henry Neeman work this week? What is Henry Neeman’s social security number?

Structures Lesson CS1313 Spring Structure Array Example #9 What is the first name of employee #1? Lee What is the last name of the employee #1? Kim What is Lee Kim’s pay rate in $/hour? 8.75 How many hours did Lee Kim work this week? 40 What is Lee Kim’s social security number? Employee Henry Neeman ( ) worked hours this week at a rate of $12.50 per hour, earning $ Employee Lee Kim ( ) worked hours this week at a rate of $8.75 per hour, earning $