{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

designingSystems

designingSystems - 2009 November 23 Designing Systems...

This preview shows pages 1–2. Sign up to view the full content.

2009 November 23 Designing Systems Example Test Questions 1. You will design and implement classes for cars. There are three types of cars: Sedan , Compact , and Sports . Each car contains an integer amount of gas. All cars respond to the gas feature, which increments the amount of gas by 1 up to a maximum of 50, and prints out “Gas!” to the standard output. Except the Compact car, which after printing “Gas!” also prints “Well, I have to work hard again”. All cars respond to the accelerate feature, which decreases the amount of the gas by 1 and increases the speed of a car by 1. A car prints out “Faster!” when it receives the accelerate feature. However, Sports cars get so excited that they prints “It really feels good!” which costs the Sports car two more units of gas, but increases the speed by another one. All the cars respond to the brake feature, which decreases the amount of the gas, as well as speed, by 1. The speed is represented by an integer between 0 and 200, except for a Sports car, which can reach 300. When the speed is greater than (3*gas – 50), a car responds by printing “Speeding!” A Sedan car will further complain “Why hurry?” The exertion of printing the extra words costs Sedan an additional unit of gas Draw a class hierarchy in BON, which specifies the relationships among all classes you designed (no interface details). Also, implement your classes in Eiffel with suitable contracts and invariants.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

designingSystems - 2009 November 23 Designing Systems...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online