Google Answers Logo
View Question
 
Q: Java Programming ( Answered,   1 Comment )
Question  
Subject: Java Programming
Category: Computers > Programming
Asked by: math01-ga
List Price: $20.00
Posted: 20 Dec 2002 02:23 PST
Expires: 19 Jan 2003 02:23 PST
Question ID: 127239
Identify the objects needed to solve the following problems. 

Problem 1. Management of airports
Problem 2. Operations of a hospital
Problem 3. Administration of a course, like the one you are currently
taking
Problem 4. Window-based operating system
Problem 5. A paint program, like MSPaint or PaintShop Pro 
Once you have identified the objects for a problem, determine the
object's state and the types of messages to which it responds.

Procedure
For each problem, identify its objects. 
For each object, determine: 
Its state 
The object messages to which it responds

Request for Question Clarification by answerguru-ga on 20 Dec 2002 08:40 PST
Hi math01-ga,

I would be happy to help you with this, but I feel the price is low
for this amount of work. I think $20-25 would be a reasonable amount
:)

answerguru-ga
Answer  
Subject: Re: Java Programming
Answered By: answerguru-ga on 21 Dec 2002 14:02 PST
 
Hi math01-ga,

As you probably know, Java is an object oriented programming language,
and so it allows for problems to be solved through the use of object
classes where instances of objects can be created and manipulated.

The following definitions should help you understand basic object
oriented modeling:

Object - a representation of a real-life entity
State variables - the characteristics associated with an object
Object messages - commands (also known as methods) that are used to
manipulate an object and its characteristics

Now on to the problems...each problem lists objects in all capitals
followed by state variables and methods. Assume that all object state
variables include appropriate constructors, accessors and mutators.
For example, if we had a Dog object that included an age state
variable:

Dog() // creates a new default Dog
getAge() // returns age of Dog
setAge(int years) // changes age of Dog to years


Problem 1. Management of airports

AIRPORT

name
location
runways
gates

addGate()
addRunway()
removeGate()
removeRunway()
changeName()

PLANE

planeID
homeAirport
seats
fuelTankSize
fuelRemaining
staffRequired
pilotsRequired
age

fillFuelTank()
incrementAge()

STAFF
staffID
name
address
phoneNo
yearsEmployed
salary
preferredLocations[]
qualifiedDuties[]

addLocation(Airport a)
removeLocation(Airport a)
incrementYears()
giveRaise(int raise)
addDuty(Task t)
removeDuty(Task t)

TASK

taskID
name
payRate

increaseRate()
rename()

PASSENGER
passengerID
name
address
phoneNo
airMiles
flightsBooked

addAirMiles(int distance)
bookFlight()
cancelFlightBooking()

FLIGHT
flightID
departsFrom
arrivesAt
passengersCarried
staffAssigned
pilotsAssigned
estimatedTime

addPassenger(Passenger p)
assignStaff(Staff s)
assignPilot(Staff s)


Problem 2. Operations of a hospital 

PATIENT
patientID
name
address
phone
deadOrAlive
nextOfKin
insuranceData[]
symptoms[]

addSymptoms()
kill()

BED
bedID
inUse
width
length
location

boolean isOccupied()
fill(Patient p)
vacate()

STAFF

staffID
name
address
phoneNo
yearsEmployed
salary
preferredShifts[]
qualifiedDuties[]

addShift(int time)
giveRaise(int raise)
incrementYears()
addQualified(int task)

DOCTOR extends STAFF
specialties[]
pagerNo
seniorityLevel
assignedNurses[]
surgeriesBooked[]

bookSurgery(int time)
addNurse(Nurse n)
removeNurse(Nurse n)
addSpecialty(int specialty)

NURSE extends STAFF
assignedDept
assignedDoctors[]

addDoctor(Doctor d)
removeDoctor(Doctor d)

Problem 3. Administration of a course, like the one you are currently
taking

INSTRUCTOR

instID
name
address
phoneNo
subjects[]
yearsTeaching
salary

addSubject(int subject)
giveRaise(int raise)
incrementYears()

STUDENT

studentID
name
address
phoneNo
coursesTaken[]
coursesRegistered[]
GPA
yearsCompleted

registerInCourse(Course c)
dropCourse(Course c)
incrementYears()

COURSE

subjects[]
level
studentCapacity
students[]
instructors[]
seniorityRequired
salaryLimit

addStudent(Student s)
removeStudent(Student s)
assignInstructor(Instructor i)


Problem 4. Window-based operating system 

PROCESS
pID
owner
permissions[]
alive
active

startProcess()
resumeProcess()
pauseProcess()
killProcess()

USER
dateCreated
dateModified
userID
name
permissions[]
settings[]
active

logIn()
changeSetting(int index, int newSetting)

FILE
fileID
fileName
path
data[]
associatedProgram
lastOpened
lastModified
dateCreated

read()
write()
print()
move()
copy()
delete()

Problem 5. A paint program, like MSPaint or PaintShop Pro  
Once you have identified the objects for a problem, determine the
object's state and the types of messages to which it responds.
 
CANVAS
location
color
length
width

resize(int length, int width)
changeColor(int color)

POINT
xCoord
yCoord
color

OVAL extends POINT
xRadius
yRadiue

RECTANGLE extends POINT
width
length


I hope that helps you understand object oriented design a little
better. Please keep in mind that the models listed above are meant to
act as examples of solutions to the problems given. The ultimate goal
of OOD is to design objects that are able to emulate the properties
and functions of a real problem, which can only be done when one is
presented with a real-life problem.

If you have any problems understanding the information above please
feel free to post a clarification and I will respond promptly :)

Cheers!

answerguru-ga

Request for Answer Clarification by math01-ga on 23 Dec 2002 03:03 PST
Hi answerguru-ga,

Just a few questions. What are the differences between STAFF:
preferredLocation[] and addLocation(Airport a) more concern about []
and (Airport a); CANVAS: changeColour(int colour); STUDENT:
increamentYear().

Clarification of Answer by answerguru-ga on 23 Dec 2002 06:03 PST
Hi again math01-ga,

The use of of [] is meant to signify the use of an array, which is a
set of like objects or data items. So the reason for
preferredLocation[] is that each staff member may have more than one
location that they like to work.

The use of () is meant to signify a method parameter and MUST follow
every method, both when it is being defined as well as when it is
being called. Parameters are values that are passed into a method for
manipulation. So for addLocation(Airport a), Airport a is  the
parameter of the method addLocation, which is meant to add an airport
to a staff member's list set of preferred locations to work.

The purpose of changeColor(int colour) is to set the value of the
color variable within the Canvas object. I'm assuming that there is a
predefined integer specification for all possible colors.

The purpose of incrementYears() in Student is to add one to the
yearsCompleted value of Student. This would done each time the student
completes one year of school.

I hope that clears everything up :)

answerguru-ga

Request for Answer Clarification by math01-ga on 23 Dec 2002 08:47 PST
Good clarification.

Clarification of Answer by answerguru-ga on 23 Dec 2002 11:27 PST
Thank you :)

If you would like, you can go ahead and rate the question.

Thanks,
answerguru-ga
Comments  
Subject: Re: Java Programming
From: aceresearcher-ga on 20 Dec 2002 06:06 PST
 
Greetings, math01!
 
Your question is an interesting one; however, I believe that for a
Researcher to answer it well, your question will require more time and
effort than the average amount of time and effort associated with this
price.
 
If you are looking for a more in-depth answer, you will be more likely
to get one if you are willing to raise the fee you are offering for
this question.
 
Here is a link to guidelines about pricing your question: 
https://answers.google.com/answers/pricing.html 
 
Regards,
 
aceresearcher

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy