Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA need HELP PLZ! This is the cpp needed. CardArrayMaster.java: /* Card Array Master is a generic class usefull for you to test your *

JAVA need HELP PLZ!

This is the cpp needed.

CardArrayMaster.java:

/* Card Array Master is a generic class usefull for you to test your * CardArrayList class. At the beginning it is heavily commented out * but as you get more and more working, you can remove sections * to test various things out. */ import java.util.*; import java.io.*;

public class CardArrayMaster {

public static void main(String[] args) { PrintStream SO = System.out; // Lazy mode enabled; // STAGE 1 // Can we add to a master list and print it out? CardArrayList masterList1 = new CardArrayList(); masterList1.add(new Card()); masterList1.add(new Card(20)); masterList1.add(new Card(10,10)); SO.print("Initial list : "); SO.println(masterList1); // STAGE 2 // Can we add a premium card? // masterList1.add(new PremiumCard(100)); // SO.print("Premium Card : "); // SO.println(masterList1);

// STAGE 3 // Can we add cars in the middle? // masterList1.add(1, new Card(4,4)); // masterList1.add(1, new Card(5,5)); // SO.print("Added internal : "); // SO.println(masterList1); // STAGE 4 // can we add more cards and make it expand? // masterList1.add(new Card(6)); // masterList1.add(new Card(7)); // masterList1.add(new Card(8)); // masterList1.add(new Card(9)); // masterList1.add(new Card(10)); // masterList1.add(new Card(11)); // masterList1.add(new Card(12)); // SO.print("After Expand : "); // SO.println(masterList1);

// STAGE 5 // Can we Remove the end value // masterList1.remove(); // SO.print("After Remove : "); // SO.println(masterList1); // STAGE 6 // Does remove return the removed value? // SO.print("Removed value : "); // SO.println(masterList1.remove() ); // SO.print("List afterward : "); // SO.println(masterList1); // STAGE 7 // Did it remove from the middle // And return the value removed? // Card tmp = masterList1.remove(2); // SO.print("Removed value : "); // SO.println(tmp); // SO.print("List afterward : "); // SO.println(masterList1); // STAGE 8 // Did get work correctly? // SO.print("Get Values : "); // SO.println(masterList1.get(2) + " : " + masterList1.get(4) ); // masterList1.get(2).weaken(); // masterList1.get(4).boost(); // SO.print("Altered Values : "); // SO.println(masterList1.get(2) + " : " + masterList1.get(4) );

// STAGE 9 // IndexOF // SO.print("Found Success : "); // SO.println(masterList1.indexOf(new Card(110,110))); // SO.print("Found Failed : "); // SO.println(masterList1.indexOf(new Card(99,99))); // SO.print("Found Failed : "); // SO.println(masterList1.indexOf(new Card(600,600))); // STAGE 10 // Does shuffle work? // SO.print("Before shuffle : "); // SO.println(masterList1); // masterList1.shuffle(); // SO.print("Post shuffle 1 : "); // SO.println(masterList1); // masterList1.shuffle(); // SO.print("Post shuffle 2 : "); // SO.println(masterList1); // STAGE 11 // Does Clear Work? // masterList1.clear(); // SO.print("After Clear : "); // SO.println(masterList1); // STAGE 12 // Create a large list // And check that sort works. // for (int i=0; i

// STAGE 13 // Can we create a second list // and make a copy of all NON premium cards // CardArrayList masterList2 = new CardArrayList(1); // for (int j = 0; j

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

OVERVIEW This program primarily focuses on the implementation of a ArrayList type interface and the necessary methods to implement the ArrayList. It also includes polymorphism and class comparison. INSTRUCTIONS Your deliverable will be to turn in three files. The files will be named Card.java, PremiumCard.java and the last file will be called CardArrayList.java. You will need support files CardSorter.java from the course web site. For this assignment, any use of a data control structure other than a simple Arrary or String will result in no credit. I am aware that this assignment could be done quite simply by the implementation of an ArrayList but the point of the assignment is to do it without the standard implementation to get a feel for how they work "under the hood" COLLECTABLE CARD While the primary goal of this assignment will be the implementation and use of a custom ArrayList. The particular implementation we will use will focus on the idea of a simple collectable card game. For our card game, we will assume that every card has two values expressed as integers. Each card will have power and a toughness rating. These numbers need to be a minimum of 1 and a maximum of 1000. Cards then have a calculated cost attribute that comes from the formula below. cost IV1.5 power 0.9 toughness Rounded up to the nearest integer

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 3 Lnai 9853

Authors: Bettina Berendt ,Bjorn Bringmann ,Elisa Fromont ,Gemma Garriga ,Pauli Miettinen ,Nikolaj Tatti ,Volker Tresp

1st Edition

3319461303, 978-3319461304

More Books

Students also viewed these Databases questions

Question

Fingerprint evidence is admissible in court. Should it be?

Answered: 1 week ago