CSC-113-Tutorial 13 - persons into another stack called “...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
KSU / CCIS / CS DEPARTMENT CSC-113, SPRING 2010 TUTORIAL 13 – Stack and Queue Exercise-1: We consider a class Person presented in the following UML. We have a file called “ person.data which contains objects of Persons. Each object contains information about name, weight, height, and status=” ”. Your job is to write a method that performs the following tasks: 1- Read the file “ person.data ” to extract all person objects and put them into queue. 2- Compute the status of each person using the following rule. If weight / (height)^2 > 27 status is “Obese” If Not the status will be “Normal Weight ”. 3- Store all the obese persons into a stack called “ obese ” and store all the normal weight
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: persons into another stack called “ normal ”. Your method should return two stacks public Stack [ ] twoStacks( ) Exercise-2: we have a queue of employees (partTime and fullTime employees) and we need to rearrange the queue such that the first part of the queue contains only the partTime employees and the second part contains only the fulltime employees. Note that the subclasses partTime and fulltime inherit form the superclass Employee. Write a method that rearranges the current queue. public void rearrangeQueue( ) Person -name : String -height: double -weight : double -status : String +Person(na: String, double h, double w) + sets… all + gets. . all...
View Full Document

Ask a homework question - tutors are online