0% found this document useful (0 votes)
27 views2 pages

CS 1083 Assignment #2

The document describes the evolution of different vehicle classes in a fictional town called Codeburg. Over time, different groups proposed and developed vehicle classes with varying abilities, like the BelleVehicle, MoanaVehicle and MiloVehicle. This led to more specific subclasses like Car, Motorcycle, ElectricPlane and ElectricKite.

Uploaded by

abhilakshay2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

CS 1083 Assignment #2

The document describes the evolution of different vehicle classes in a fictional town called Codeburg. Over time, different groups proposed and developed vehicle classes with varying abilities, like the BelleVehicle, MoanaVehicle and MiloVehicle. This led to more specific subclasses like Car, Motorcycle, ElectricPlane and ElectricKite.

Uploaded by

abhilakshay2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Winter 2024 CS 1083 Assignment #2: Due Wednesday January 31st , 2024

Submission instructions:
BOTH QUESTION # 2, #3 AND QUESTION #6 ARE BEING HANDED IN AND GRADED. PRINT
THE CODE FOR THESE QUESTION ON PAPER (single sided if possible).

STAPLE THIS PRINTED PAGE AS YOUR COVER WITH YOUR NAME IN THE TOP RIGHT COR-
NER AS DETAILED IN THE UNB COURSE LIST.

INCLUDE THE CODE ON A USB DRIVE (PROPER ORGANIZATION AND FOLDERS EXPECTED)
IN AN ENVELOPE STAPLED TO YOUR PAGES. DO NOT STAPLE SO YOUR ASSIGNMENT IS NOT
OPEN-ABLE.

Remember assignments must either be in the box by 12:20pm on the due date, or on the desk by 12:30
to avoid penalties.
1. Read Chapter 9 (yes, again) of the Text
2. In the next page is a description of a family of classes and details about characteristics and behaviors of
them. Construct (by hand - cleanly) an inheritance structure presented with UML diagrams. Remember
to move common attributes and characteristics as high up the structure as possible. Also add the word
< abstract > above the class name in the UML box if you believe that class should not be allowed to
be instantiated.
3. The Card class from assignment 1 is posted in D2L (please rely on my copy for marking consistency).
Create a NEW CLASS BlackJackCard which does the following
ˆ inherits from Card
ˆ adds a new variable to represent the BlackJack value of a card (assume Ace is always 11 here)
ˆ adds any necessary accessor methods
ˆ adds a mutator method called downgrade which decreased the value of an Ace by 10. Assume it
is only ever called on an Ace.
ˆ Overrides the toString method by naturally adding to the one in the Card Class.
ˆ Write a Driver program whose main method instantiates and prints out 1 standard deck of such
cards.
Print the BlackJackCard program, the driver program, and a clear printout of your output as part of
your submission
4. Modify your Deck program, HandOfCards program and BlackJack game from Assignment 1 to more
efficiently use these new BlackJack Cards.
5. Imagine a game of Cards called ExtremeBlackJack (which uses cards). In this game the value of a
BlackJackCard is multiplied by a characteristic called the suitValue where “spades” has a suitValue of
0, diamonds = 1, hearts = 2 and clubs = 3. Create a new class called ExtremeBlackJackCard using
inheritance from BlackJackCard. Make any and necessary modifications).
6. Consider the game of Hearts (which uses cards). In this game each heart card is worth 1 point, each
other card worth nothing with the exception of the “Queen of Hearts” which is worth 13. Create (using
inheritance) a HeartsCard Class.
7. (optional - really just a fun idea). Many of you struggled with problem solving and I think games are
good examples. Try making a method which accepts a handofHeartsCards and adding up its value.
Then try programming the game of hearts. This is only for those needing practice and enthusiastic.
Once upon a time, in the bustling town of Codeburg, there was a diverse community of people with the
need for transportation. They desired the idea of vehicles that could roam and carry passengers around
the digital roads. Over centuries of milliseconds, these vehicles would grow to come in many different sizes
and forms, with many different characteristics and abilities. As the towns inhabitants come from different
backgrounds and parts of the digital world, a decision was made to put out a call to start creating such things.

**Eon 1: The Origin of Vehicles**

The mayor of Codeburg proposed the concept known as ”Vehicle.” This concept was to produce a way
for different people of Codeburg to travel around as desired. He indicated that each vehicle should have
a named manufacturer, an invention year, and a capacity (number of people that could use the vehicle at
once). It should also have a concepts of starting (he forgot to think about stopping - silly mayor) and move.

**Eon 2: The Separation **

The town of Codeburg was always separated into three types of people, the Primitives, the Basics and
the Structures. Each area of Codeburg rushed off independently to create concepts to propose to the Mayor.
Primitives proposed a ‘’BelleVehicle.”, Basics proposed the “MoanaVehicle” and Structures proposed the
“MiloVehicle”. These concept each, of course, met all the conditions of the Mayor, but added more features.

The “BelleVehicle” was designed to add a fuel capacity, a number of tires, a speed and a weight. It would
also have the ability to both increase and decrease it speed. It was not yet something that could be visu-
alized, but the Primitives knew it could be expanded on. The “MoanaVehicle” would add a fuel capacity,
and a speed. It added the ability to speedup and also the ability to duplicate itself. It also added a level
of translucency. The “MiloVehicle” was quite unique, always having 2 tires, having a set speed, but having
no need for fuel. This vehicle traveled at a set speed and as such did not require speeding up nor slowing down.

**Eon 3: Specifications**

The Primitives decided to design, and even constructed instances of, two specific devices based on their
idea of a BelleVehicle: the ‘’Car” and the ‘’Motorcycle.” The Car, with its variable body style, had addi-
tional methods like ‘honk’ and implemented the methods ‘start,’ ‘stop,’ and ‘move.’ On the other hand,
the Motorcycle, known for its smallness and fuel efficiency, introduced the ‘wheelie’ method alongside the
required ‘start,’ and ‘move.’ After a demo, it was corrected to add a ‘stop’ method.

The Structures expanded on the idea of a MiloVehicle into a new innovation: “ElectricVehicles”, which
would go on to create two amazing ideas: the “ElectricPlane” and the“ElectricKite”. Each would have
exactly two new abilities (all 4 distinct from each other), but unfortunately they did not find time to expand
on this before being distracted by a maple leaf in the wind. oh a leaf............................... the most important
leaf in Codeburg history................... i must consume its a power.................

The Basics are still processing as their capabilities are not very strong on their own anymore.

PS: January 31st (assignment due date) is my wonderful daughters 17th birthday. So a bonus mark on
the assignment will be given for each person that submits an original hand drawn piece of art that celebrates
her birthday (loves cats, loves Disney, loves boardgames, dislikes math, like programming, works at Tims,
wants to be an artist, loves cooking, has me for an annoying dad, into death and dismembering like all teen
girls). This should be separate from your assignment and submitted in a separate pile (needs your name).
This art might come in handy on assignment #3 (hint hint).

You might also like