[x] Go back to a C# assignment and refactor to use classes
[x] Make Classes for a Bike, Unicycle, Car, Truck, and MotorCycle using interfaces and parent classes to reduce code duplication
Epic Mode
[x] Allow users to create and name a new Humans
[x] Allow the user, as a human, to adopt as many Robots and Pandas as possible
[ ] Save your classes and data to a file, and load them when the starts
Turning In
Your homework will be assigned to you via issues on your assignments repository. Once you are
These steps will be followed for almost every assignment going forward. Once you've completed at least explorer mode and you're satisfied with your work, let's get it published. First let's get it up on GitHub.
First, let's add all our work to git, and ask it to commit it:
git add .
git commit -m "My first webpage"
Feel free to replace "My first webpage" with a more meaningful message.
Push our local commits to GitHub:
git push -u origin master
The -u option tells git we want to making pushing the master branch to origin the default, so next time, we can just type git push.
Robots, Humans, Pandas and SOLID
Tonight you will be making a few classes that inherit from a base class and also reading about some OOP design princples
Objectives
Explorer Mode
[x] Start by Creating 3 classes, Human, Panda & Robot
[x] All three classes have a Name and Birthday
[x] Robots have a
VersionNumber
[x] All three classes have a boolean property,
IsAsleep
that is private[x] The Human and Panda classes have a Method call
WakeUp()
andFallAsleep()
that toggles theIsAsleep
property[x] The Robot has a
StartUp()
andShutDown()
that toggles theIsAsleep
property[x] The Human and Panda have a
Eat(string food)
Method that prints out that object is eating[x] All three classes have a
SayHello()
Method that say that classes greeting[x] Human can have many pets. Both a Panda and Robot can be pets
[x] Humans have a
Adopt(Pet pet)
method that adds a Pet to their own Pet list[x] All Pets have
OwnersName
property that is only set when a pet is Adopted by a Human[x] Override all the
ToString()
to print out all the properties[x] Create a small sample app that demonstrates:
[x] Read these articles, we will be discussing them together in lecture
Adventure Mode
Bike
,Unicycle
,Car
,Truck
, andMotorCycle
using interfaces and parent classes to reduce code duplicationEpic Mode
Turning In
Your homework will be assigned to you via
issues
on yourassignments
repository. Once you areThese steps will be followed for almost every assignment going forward. Once you've completed at least explorer mode and you're satisfied with your work, let's get it published. First let's get it up on GitHub.
First, let's add all our work to git, and ask it to commit it:
Feel free to replace "My first webpage" with a more meaningful message.
Push our local commits to GitHub:
The
-u
option tells git we want to making pushing themaster
branch toorigin
the default, so next time, we can just typegit push
.Additional Resources