Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Result from Exercise 1 until Exercise 6 pass or fail Source Code Solution. Appendix 1: PointerExeedException.java. simplified.blackjack finals Deck ArrayList-stackOfCards: Card +Deck +drawCard(): Card +shuffle():

Result from Exercise 1 until Exercise 6 pass or fail

Source Code Solution.

Appendix 1: PointerExeedException.java.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

simplified.blackjack finals Deck ArrayList-stackOfCards: Card +Deck +drawCard(): Card +shuffle(): boolean 1. Create class Deck as shown in Figure 2. 2. Implementation for constructors and methods are as follows:- a. The constructor will create a set of cards for all four symbols - heart, diamond , spade and club 4. Each symbol will consist of Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, King, Queen, Jack and Joker. b. Method drawCard() will draw a card from the top of the deck. c. Method shuffle() to arrange the card in random order. Use Collection to shuffle the cards. Refer to Java API. 3. Provide appropriate comments to class Deck 4. Fix all errors and save Deck.java. 5. Record the result in Table 1. Figure 2: Class Deck in UML Table 1: Deck.java compilation result Expected Result Result Deck.java compiles Pass / Fail successfully Exercise 2 1. a Table 2 : Output from DeckDemo.java Expected Result Generate 10 cards from Deck Result 2. Pass/ Fail 3. Create Java class named Deck Demo. This class will have a main() method. Shuffle the Deck, generate ten (10) cards from it and display the output. Provide appropriate comments to the program. The output should be something similar to Table 2. Your output might be different from Table 2 because the deck is shuffled and cards are arranged in random order. Record the result in Table 2. Number |Face Value Symbol 4. 5. 1. 2. 3. 14. 5. 6. 7. 8. 9. 10. King 6 5 Ace 17 5 17 5 5 10 Lab 10 | BITP 3113 Object Oriented Programming Exercise 3 1. Open Player.java. 2. Create a new constructor that will receive four parameters that include name, height, weight and play date. 3. Provide sufficient comments to the class. 4. Fix all errors and save Player.java. 5. Record the result in Table 3. Table 3: Player.java compilation result Expected Result Result Player.java compiles successfully Pass / Fail Exercise 4 1. Create a Java class named Demo PlayerDate. This class will have a main() method. 2. Write the code in as shown in Figure 3. 3. Provide sufficient comments to the program. 4. Save, fix all errors and run Demo Player Date.java. 5. The program shall display an output similar in Table 4. Table 4: Output from Demo PlayerDate.java Expected Result Result Pass / Fail Today is 24/10/2014 | Player | Play Date Duration | Emma McKay 105/2/1954 1 60 /t* 1 2 3 This program demonstrate the usage of Calendar to manipulate and format date * @author Emma McKay-Eikri, UTEM 4 24 25 5 6 package apps.blackjack; 7 8 import java.text.SimpleDateFormat; 9 import java.util.calendar; 10 import java.util. GregorianCalendar; 11 import simplified.blackjack.Player; 12 13 public class Demo PlayerDate ! 14 15 16 * Main entry point of Java program 17 * @param args 18 19 public static void main(String[] args) { 20 21 // Formatting date and time according to Malaysian style 22 SimpleDateFormat malaysianDate = new SimpleDateFormat("dd/M/YYYY."); 23 // Get current date and display Calendar currentDate = new Gregoriancalendar(); 26 System.out.println(" \t\tToday is " 27 + malaysianDate.format(currentDate.getTime())); 28 29 // Display table header 30 System.out.println("\t\tt- 31 -+"); 32 System.out.println("\t\t Player\t Play Date\t | Duration\t"); 33 System.out.println("\t\t+-- 34 +"); 35 36 // Create player 37 Calendar emmaPlayDate = new GregorianCalendar (1954,1,5); 38 Player emma = new Player ("Emma McKay", emmaPlayDate); 39 40 // Display player's information 41 System.out.print("\t\t" + emma.getName()); 42 System.out.print("\t " + malaysianDate.format( 43 emma.getPlayDate().getTime())); System.out.println("\t\t" + emma.calculatePlayingDuration() + "\t"); // Display bottom border System.out.println("\t\tt-- 45 46 47 48 50 51 52 Lab 10 | BITP 3113 Object Oriented Programming Exercise 5 1. Create three (3) more Player's objects in Demo PlayerDate.java. 2. You may use the data created in the previous lab. 3. Use ArrayList manage the objects and to repeat the same task. 4. DemoPlayerDate.java shall display output as shown in Table 5. 5. Provide sufficient comments to the class. 6. Fix all the errors, save and run DemoPlayerDate.java. 7. Record the result in Table 5. Table 5: Output from Demo PlayerDate.java after adding 3 more Player's object Expected Result Result Today is 24/10/2014 Pass / Fail I Player I Play Date | Duration Emma Mckay | 05/2/1954 Ahmad Ismail 19/6/1969 I Zidane | 25/11/2012 I Madhu Taneja 13/3/2007 1 1 60 45 2 7 1 Exercise 6 1. Create a Java class named Dealer. This class will have main method. 2. Create four Player's objects. You may use the same data created in the previous lab exercises. The players need to be relocated to France, Denmark or Algeria if they are not eligible. 3. The program should display output similar in Table 6. Some of the data might be different because the Deck shuffled the cards and it is arranged at random order. 4. Write several methods in Dealer to ease the implementation. 5. Provide sufficient comments to the class. 6. Fix all the errors, save and run Dealer. 7. Record the result in Table 6. Lab 10 | BITP 3113 Object Oriented Programming Table 6: Result from Dealer.java Expected Result Resul t This is to demo Black Jack game that uses all OOP principles Pass/ Fail List of Player for Simplified Black Jack Number Name Play Date Location Eligible Relocation Denmark 1. 2. 13. | Emma Mckay | 05/2/1954 | Ahmad Ismail | 19/6/1969 | Zidane z. | 25/11/2012 | Madhu Taneja | 15/10/2006 | Melaka NO | France | Yes | Algeria Yes Mumbai, India No 14. Denmark Total Player : 4 **Emma McKay throws Points exceeds 21 Details of Player for Simplified Black Jack Name : Emma McKay (Total Points : 30) Cards : Jack-+ Jack - Joker - Name : Ahmad Ismail (Total Points : 21) Cards : 7- Queen- 4- Name : Zidane z. (Total Points : 21) Cards : 6-9-6- Name : Madhu Taneja (Total Points : 19) Cards : 2- 7- Joker

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions