CECS 282
LAB ASSIGNMENT 4
Assigned date: 9/19
Due date: Tue 9/24
20 points
Problem 1 [15 points]
The idea of this program is to create an array of pointers to objects of the person class. The program can sort a group of person objects based on the alphabetical order of their names or the numerical order of their salary.
Requirements:
- Create class called person with the following property and methods:
- name
- salary
- void setPerson() //input name and salary
- string getName()
- float getSalary()
- Create a function called bsort to sort pointers to objects.
- void bsort(person **, int n, bool s)
n is an the number of person objects stored in the array
s is true, then sort by name;otherwise, sort by salary.
- order(person**, person**) //orders two pointers
In the the function bsort, call the function order to swap array elements for sorting.
- In the function bsort, call the function order to the pointers contents
- In the main function
- Create an array of pointers to persons.
- Input person objects and put them into the array.
- Display the unsorted array of persons
- Call the function bsort to sort pointers (by name and by salary)
- Display the sorted list
Problem 2 [5 points]
Redo problem 1 without creating the function order.
GRADING
- Inside the program, put your name at the beginning of your program
//YOUR NAME
// CECS 282 LAB 4
- Return a hard copy of the lab assignment
- Demonstrate the lab assignment in the lab
- Submit the lab assignment to the BeachBoard
- Grade based on the successful execution of the program and the coding efficiency.