Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description: In this homework, you will generate a more complex solution that contains a class structure used to store the location of an employee, and

Description: In this homework, you will generate a more complex solution that contains a class structure used to store the location of an employee, and check his location with a location database. You have to create 4 classes 1. Point 2. Employee 3. Set 4. Location Class Point : Class Point is very simple and will store coordinates x and y as private int variables. Class Point will have, as a minimum, the following public members. You are allowed to add as many other public and private members as you need for your solution. 1. SetY(int), int GetY() 2. SetX(int), int GetX() 3. Default constructor which initializes x and y to 0 4. At least one initialization constructor that sets x and y as constructor parameters. Class Employee: Class Employee will store employee name as private string data member. This class will be composed of a Point, where the coordinates (i.e. Point) of the Employee will be stored. Class Employee should have, as a minimum, the following public members. You are allowed to add as many other public and private members as you need for your solution. 1. Constructor which sets employee name and the employhees coordinates from the received values. 2. GetCoordinates(Point & point) 3. SetCoordinates(Point & point) 4. GetName(string & name) 5. SetName (string & name) Class Set: Class Set will keep track of the numbers that are contained within a set. Values in the set range from 0 to 20, inclusive. The Set will keep track of values in the set using a simple vector. If an element in the vector is true, the number is in the set. If the element of the vector is false, the number is not in the set. Class Set should have, as a minimum, the following public members. You are allowed to add as many other public and private members as you need for your solution. 1. A constructor that initializes the set with a given vector. (I.e. Set::Set(vector & v)) 2. bool IsMember(int x) 3. Set Union(Set & S) // returns a Set the represents the Union of this set and S 4. Set Intersection(Set & S) // returns a Set that represents the Intersection of this set and S 5. Print() // prints the members of this Set Class Location: Class Location will store the coordinates of several large US cities. The Location class will be composed of several Set classes (two for each location). For example, the Location class will know the location of New York City because Location will be composed of a Set that contains the X values for New York, and another Set that contains the Y values for New York. X between 0 to 5 and Y between 0 to 5 = New York City X between 6 to 10 and Y between 6 to 10 = San Francisco X between 11 to 15 and Y between 11 to 15 = Los Angeles X between 16 to 20 and Y between 16 to 20 = Chicago Class Location should have, as a minimum, the following public members. You are allowed to add as many other public and private members as you need for your solution. 1. Default constructor that initializes all the Sets for New York, San Francisco, Los Angeles, and Chicago 2. LOCATION GetLocation(Point &p) a. Where Location is an enum you define, as follows: enum LOCATION(NOT_FOUND, NEWYORK, SANFRANSISCO, LOSANGELES, CHICAGO) You will create 2 programs for this homework, as follows. Therefore, you could create a solution that has two projects. 1. Your first program (SetTest.cpp) will be a simple test driver to test your Set class. You must test each of the public member functions by creating known Sets, then calling the Union and Intersection members to see that you have the correct results. The test driver should print all input and output information to the screen, so that it is clear when your test driver is run that the Sets are working correctly. 2. Your second program (EmployeeLoc.cpp) should prompt the user to enter the name and location for an employee, and the program will print out where that employee is located (EmployeeLoc.cpp) For example if you create an Employee with name Mark and x = 4 and y = 3; then it should print Mark is in New York City If x = 6 and y = 10 then it should print Mark is in San Francisco If x = 8, y = 20 then it should print Marks location not found If the user enters -1 for x or y it should exit. The output screen should look something like this. Enter Employee Name: Mark Enter X position (-1 to quit): 4 Enter Y position (-1 to quit): 5 Mark is in New York City Enter Employee Name: Erin Enter X position (-1 to quit): 14 Enter Y position (-1 to quit): 15 Erin is in Los Angeles Enter Employee Name: Maria Enter X position (-1 to quit): 4 Enter Y position (-1 to quit): 15 Marias location not found You should provide with 10 files, including Point.h, Point.cpp, Employee.h, Employee.cpp, Set.h, Set.cpp, Location.h, Location.cpp, EmployeeLoc.cpp, and SetTest.cpp

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago