Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

EGR 126 – Work #11 - Class / Object Analysis fill out the table below: Question

ID: 3681283 • Letter: E

Question

EGR 126 – Work #11 - Class / Object Analysis

fill out the table below:

Question #1

xCoordinate         Point             yCoordinate                       1,4                      -2,3                   5,1

operator-       operator==        getX             setX

Class:

Attribute(s) of the Class:

Method(s) of the Class:

Examples of Objects:

Question #2:

joeSmith          getFirstName           Person          firstName          lastName         email

setFirstName                       getLastName                            getFirstName

Class:

Attribute(s) of the Class:

Method(s) of the Class:

Examples of Objects:

Question #3:

Employee          firstName           salary                  lastName           janeDoe             socialSecurityNumber

Class:

Attribute(s) of the Class:

Method(s) of the Class:

(not mentioned in the list – what do you think they should be?

Examples of Objects:

Question #4

Create your own example

Class:

Attribute(s) of the Class:

Method(s) of the Class:

Examples of Objects:

xCoordinate         Point             yCoordinate                       1,4                      -2,3                   5,1

operator-       operator==        getX             setX

Class:

Attribute(s) of the Class:

Method(s) of the Class:

Examples of Objects:

Explanation / Answer

Question #1:

Class: Point
Attribute(s) : xCoordinate, yCoordinate
Method(s): operator-, operator==, getX, setX
Example: (-2, 3), (5,1),(1,4)

Question #2:

Class: Person
Attribute: firstName, lastName, email
Method: getFirstName, getLastName, setFirstName, setLastName
Example: joeSmith

Question #3:

Class: Employee
Attribute: firstName, lastName, salary, socialSecurityNumber
Method: setFirstName, setLastName, getFirstName, getLastName,
       setSocialSecurityNumber, getSocialSecurityNumber
       setSalary, getSalary
Example: janeDoe

Question #4:

Student, Alex, firstName, getFirstName, setFirstName
           lastName,getLastName, ID, setLastName, grade,
           getId, setId
          
Class: Student
Attribute: firstName, lastName, ID, grade
Methods: setFirstName, setLastName, getFirstName, getLastName,
           getId, setId
Example: Alex