# Task 5 - Identifying Inheritance

8 Pages2037 Words334 Views
|
|
|
IAPP001 Applications ProgrammingWorkshop Week 4ObjectivesUse enum and LinkedList structuresTask 1 – Complex enum DemonstrationYour tutor will demonstrate how to create the complex enum Rank.10 minute exerciseTask 2 – Designing a deck of cardsYour tutor will distribute to each group a deck of cards; use the deck to brainstorm the design.A deck of cards has 52 cards made up of 4 suits (Hearts, Diamonds, Clubs, Spades) and 13 ranks (Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace) for each suit. The ranks have values 2,3,4,5,6,7,8,9,10,10,10 & 10 respectively.A Card has a suit and a rank (passed into the constructor), a getValue() that returns the value of the rank and a toString() method that returns the suit value and rank value as a String.Deck has a LinkedList of Card objects, a display() method to display all card objects, a random() method to A index into the list and get a random card and a draw() method that returns a random Card.10 minute exerciseName:Student Number:DeckCardSuit [enum]Rank [enum]
IAPP001 Applications ProgrammingTask 4 – Reading CodeAs a group of 2-4 students, build the class diagram for each of the following classes: public class Video { private final double PRICE = 5.0; private int id; private String name; private int period; private Customer renter; private Status status; public Video(int id, String name, int period) { this.id = id; this.name = name; this.period = period; } public boolean matches(int id) { return this.id == id; } public void rent(Customer customer) { //set video status to rented System.out.print("\tVideo rented: " + name); status = Status.RENTED; renter = customer; } public void videoReturn() { //set video status to not rented System.out.println("Video id:"); status = Status.FOR_RENT; renter = null; } public double getPrice() { return PRICE; } public String getName() { return name; } public boolean isOut() { return status == Status.RENTED; }Name:Student Number:

## End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents

### Support

#### +1 306 205-2269

Chat with our experts. we are online and ready to help.