CS1011
Class Exercise
## UML Class Diagrams Consider the following two classes: <div style="margin: 0 auto"> <div style="float: left; margin: 0; width: 50%"> <table style="border: 2px solid black; font-family: menlo, monaco, consolas, monospace"> <tr> <td style="text-align: center">DogDriver</td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td> +<u>main(args: String[]): void</u><br /> +<u>createDog(in: Scanner): Dog</u><br /> ... </td> </tr> </table> </div> <div style="float: right; margin: 0; width: 50%"> <table style="border: 2px solid black; font-family: menlo, monaco, consolas, monospace"> <tr> <td style="text-align: center">Dog</td> </tr> <tr> <td> -breed: String {readonly}<br /> -color: String {readonly}<br /> -name: String </td> </tr> <tr> <td> +Dog(breed: String, color: String)<br /> +setName(name: String): void<br /> +getName(): String<br /> +getColor(): String<br /> +getBreed(): String<br /> +sit(): void<br /> +speak(): void<br /> +receivePraise(): void<br /> ... </td> </tr> </table> </div> </div> ## Group 1: `DogDriver` Class As a group, study the sample output from multiple runnings of the program below. * Identify any additional methods not supported by the current design. * Get any updated design for the `Dog` class from group 2. * Divide into subgroups to implement the `DogDriver` class. ## Group 2: `Dog` Class As a group, study the sample output from multiple runnings of the program below. * Identify any additional functionality not supported by the current design. * Update the UML diagram and share it with group 1. * Divide into subgroups to implement the `Dog` class. ## Run 1 > Welcome to build a dog. > What breed do you want? > __Lab__ > What color do you want? > __Yellow__ > Lab's are very loyal creatures and his Yellow fur really shows off his... unique, personality. > What is his name? > __Bella__ > Bella is excited to meet you! > Your dog is a: Yellow Lab named Bella > Try asking him to sit or speak. He loves being told "good dog". > __sit__ > Bella sits. > Your dog is happy to please you... > arf arf > Bella wags their tail. > Bella wore himself out. > Bella sits. ## Run 2 > Welcome to build a dog. > What breed do you want? > __German Shepherd__ > What color do you want? > __Brown/Black__ > German Shepherd's are very loyal creatures and his Brown/Black fur really shows off his... unique, personality. > What is his name? > __Max__ > Max is excited to meet you! > Your dog is a: Brown/Black German Shepherd named Max > Try asking him to sit or speak. He loves being told "good dog". > __speak__ > arf arf > Your dog is happy to please you... > arf arf > Max wags their tail. > Max wore himself out. > Max sits. ## Run 3 > Welcome to build a dog. > What breed do you want? > __Poodle__ > What color do you want? > __White__ > Poodle's are very loyal creatures and his White fur really shows off his... unique, personality. > What is his name? > __Daisy__ > Daisy is excited to meet you! > Your dog is a: White Poodle named Daisy > Try asking him to sit or speak. He loves being told "good dog". > __good dog__ > Daisy wags their tail. > Your dog is happy to please you... > arf arf > Daisy wags their tail. > Daisy wore himself out. > Daisy sits. ## Run 4 > Welcome to build a dog. > What breed do you want? > __Bulldog__ > What color do you want? > __Red__ > Bulldog's are very loyal creatures and his Red fur really shows off his... unique, personality. > What is his name? > __Tank__ > Tank is excited to meet you! > Your dog is a: Red Bulldog named Tank > Try asking him to sit or speak. He loves being told "good dog". > __roll over__ > The dog doesn't understand the command 'roll over' > Your dog is happy to please you... > arf arf > Tank wags their tail. > Tank wore himself out. > Tank sits.

Tuesday, 23-Oct-2018 04:27:15 CDT