judiMc / oopExamples

repository to contain the solutions for the practice problems for the scioer e-text on oo programming in java.
GNU Affero General Public License v3.0
1 stars 0 forks source link

ooDesign/frankensteinClass #17

Closed judiMc closed 2 years ago

judiMc commented 2 years ago

Most classes in an object oriented program consist of some functionality and primitive types as well as some other embedded object types. This practice problem will give you experience creating such a class using a nonesensical context. Create a class called Frankenstein that includes a String, a double, a Song (from the OO Concepts section) and a Pet. You can use one of the examples from the wiki for the pet class.

Ensure that your Frankenstein class has methods that allow the programmer to interact with the aggregate classes without needing to know about those classes. For example, the Frankenstein class might have a setTheSong(String) method that takes a string representation of a song, parses it, and creates a song object from it. It would also have methods for getting the song.

Create a method in the Frankenstein class that sets the String member variable to some nicely formatted combination of the Song and the Pet information. Create another method in the Frankenstein class that sets the double member variable to be the average number of alphanumerics in the aggregate classes.

One possible solution to this practice problem can be found on your docker container at: /course/practiceProblems/ooDesign/frankensteinClass