Question: Project: Kotlin Classes Create a program which implements the following Kotlin Classes to store object information. (DO NOT USE DATA CLASSES) Write some Kotlin statements
Project: Kotlin Classes
Create a program which implements the following Kotlin Classes to store object information. (DO NOT USE DATA CLASSES)
Write some Kotlin statements that exercise the class by creating an object, set attributes, get attributes, print attributes, and execute each of the class methods.
Submit ONE file (.kt) for this assignment. Put all the classes and code in this single file. There should be NO user input. All code will be "hard-coded" with your own examples for testing the code.
Person Class: Attributes: firstName, lastName, age, hairColor, eyeColor Methods: getter and setter for each attribute (May be implied) .toString() - print out a nice representation of the attributes of this person class Address Class: Attributes: line1, line2, city, state, zip Methods: getter and setter for each attribute (May be implied) .toString() - print out a nice representation of the attributes of this address class. Character Class: Attributes: name, race, hitPoints, gold, weapons (MutableList of weapon names), clothing (MutableList of clothing item's names) Methods: getter and setter for each attribute except for weapons and clothing (Use the 4 methods below for setting/getting those attributes) toString() - print out a nice representation of the attributes of this Character class .addWeapon( weapon_name ) .dropWeapon( weapon_name ) .addClothing( item ) .dropClothing( item )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
