Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A standard deck of playing cards consists of 52 Cards in each of the 4 suits of Spades, Hearts, Diamonds, and Clubs. Each suit contains

image text in transcribedimage text in transcribed

A "standard" deck of playing cards consists of 52 Cards in each of the 4 suits of Spades, Hearts, Diamonds, and Clubs. Each suit contains 13 cards: Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King. 1. Use NetBeans to create a new project called "Game". When you create the project, a class called Game.java will be created with a main method. 2. Add a new file: "Card.java" as a java class to your project. (4pts) In this class, you need to define the private attribute of the Card, such as faceValue, suit. You also need to define a constructor and other necessary methods such as get and toString(). The toString() method should display the card information in a String format. The get methods should return the Suit and Value. Partial code for the definition of Card class: private int suit, value; private String[] cardSuit = { "Spades", "Diamonds", "Hearts", "Clubs" }; private String[] cardValue = \{"Ace", "King", "Queen", "Jack", "10", "9", "8", "7", "6", "5", "4", "3", "2"\}; public Card(int cSuit, int cValue) \{ suit = cSuit; value = cValue; public string tostring() d String cardinfo = cardValue [value] + " of " + cardSuit[suit]; return cardinfo; 3. Add a new file: "Deck.java". The deck is a class in the card game. It includes 52 cards. i. Use an arraylist to represent the deck of cards. (4pts) Arraylist tutorial can be found online at 4. In the main method of Game.java file, call your printAllCard() method and print all cards value and their suites. (2pts) 5. Include your JUnit code (See JUnit code requirements on the next page) 6. Build a jar file for your project To build a jar file for your project, right-click on your project, choose Clean and Build. A jar file will be placed in your project folder under the dist/ subfolder. If you are having trouble building a jar, ensure NetBeans preferences are set to build one: right-click project, choose Properties, choose Build > Packaging, check Build JAR after Compiling. Submission: (1) submit the source code and compiled code, including the jar file, in a zip file (find your project location and right click it, select send to compressed folder) to Western Online. (2) submit a screenshot of the printAllCard() output to Western Online. (3) Both your source code and compiled code, including the jar file, should also be committed to your assignment Git repository to fulfill the requirements of the Git portion of this Lab. JUnit (5pts) 1. Add a new file: "CardTest.java". Write a JUnit @test method to test all Card.java get methods. The test should return true if the get method it is testing returns the expected value. You must test at least 5 Card objects. 2. Add a new file: "DeckTest.java". Write a JUnit @test method for Deck.java. It should return true if the deck has 52 cards. 3. Add a new file "AllTest.java". Write a test suite to run all JUnit tests. For the Junit tests, you may use any assert function when validating the expected result of the Card get methods and Deck countCards method. Submission: submit JUnit source code and compiled code as part of the Game code zip file, and submit a screenshot of the JUnit test results. Include the compiled code in the Game jar file

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

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

Students also viewed these Databases questions

Question

1. Identify what positions are included in the plan.

Answered: 1 week ago

Question

2. Identify the employees who are included in the plan.

Answered: 1 week ago