Question
PLEASE PLEASE! PROVIDE COMPLETE ANSWER ALSO PLEASE PLEASE! DO NOT COPY FROM OTHER EXPERTS THANK YOU SO MUCH Card.java Variables: All variables must not be
PLEASE PLEASE! PROVIDE COMPLETE ANSWER
ALSO PLEASE PLEASE! DO NOT COPY FROM OTHER EXPERTS
THANK YOU SO MUCH
Card.java Variables: All variables must not be allowed to be directly modified outside the class in which they are declared, unless otherwise stated in the description of the variable. The Card class must have these variables: hitPoints the hit points, or HP, of the Card as a whole number pokemonName the name of the Pokmon on the Card (example: Pikachu) pokemonType the type of the Pokmon on the Card. This variable must be of type PokemonType. attack the name of the attack on the Card (example: Quick Attack) condition Trading cards have a condition category ranging from 40 (inclusive) to 100 (inclusive). Ensure that condition is always a whole number in the appropriate range. Once condition is initialized, it should print o Card condition: Mint if the score is from [90, 100]
Card condition: Excellent if the score is from [80, 89] o Card condition: Very Good if the score is from [70, 79] o Card condition: Good if the score is from [60, 69] o Card condition: Fine if the score is from [50, 59] points o Card condition: Damaged if the score is from [40, 49] points. If the condition is not within the appropriate range, then set it to 80 and print the correct statement. This should only be printed when condition is first initialized (i.e. on construction). Constructor(s): A constructor that takes in the hitPoints, pokemonName, pokemonType, attack, and condition A constructor that takes in hitPoints, pokemonName, and pokemonType. In this case, attack should be assumed to be Hyperbeam and condition should be assumed to be 80. A constructor that takes in no arguments. In this case, hitPoints should be 120, name should be Ditto, pokemonType should be NORMAL, attack should be Imposter, and condition should be 89. NOTE: the constructor parameters should be in the order listed above. Methods: All methods should have the proper visibility to be used where it is specified, they are used. isRestorable o This method returns true if the Cards condition is between [50, 89], and false otherwise. toString o This method will return a String representation of a Card. o The string must be formatted as follows (note the string is all in one line): <{value1},{value2},{value3},{value4},{value5},{value6}> {valueN} should be displayed in the following order: hitPoints, pokemonName, pokemonType, attack, condition, isRestorable() o The method String.format should be used to accomplish this. Getters and setters only as necessary Any helper methods that you may need; ensure that these methods are not accessible outside of this class.
-----------------------------
Collection.java This file defines a Collection object. Variables: All variables must not be allowed to be directly modified outside the class in which they are declared, unless otherwise stated in the description of the variable. The Collection class must have these variables: binder a value that represents the Cards stored in the Collection, represented by an array of Card objects o NOTE: Treat this array like a binder of empty sleeves that can hold cards. If you take a Card out of the sleeve, there is no need to move all the other Cards forward one sleeve to ensure a space is not empty. You should also think about how we represent the absence of an object when we have reference types. There must be a value in the reference, but what value for reference types is suitable to represent empty? cardsOwned the number of Cards that this Collection holds, initially always 0. Constructor(s): A constructor that takes in binder. Dont forget to initialize the cardsOwned variable based on the number of cards in the binder. A constructor that takes in no parameters but initializes binder to an array of size 4 with no Card objects and cardsOwned to 0. NOTE: The constructor parameters should be in the order listed above. Assume that constructor inputs will be valid (i.e., binder will not be null). Methods: All methods should have the proper visibility to be used where it is specified, they are used. addCard o Given an index represented by an integer and a card represented by a Card parameter, add that Card to the index in the binder array and print out the Card that was previously at that index in the following format: Replaced: {oldCard} and return the Card object that was previously in that slot. If there is not a Card already at the index, print out the Card being inserted in the following format Inserted: {card} and return null. o Note that you can print out a Card directly since we implemented the toString method above. In the following weeks, we will go more in-depth as to why this is the case! o If the index is invalid or the Card passed in is null, return null and print out Cannot add a card to this spot. o Update cardsOwned if there was not already a Card there. sellCard o Given an index, sell the Card that is found there and print out on a new line Sold: {card}. Remove and return the Card object that was sold. o If the index is invalid or there is not a Card at that index, print out on a new line There was no card to sell! and return null. o Update cardsOwned if a Card was removed.
showCertainCards o Given a numerical condition, display all Cards with a condition greater than the value passed in. o Print each Card on a new line. o HINT: As youre writing this method you will likely run into an exception. Consider what it is and how you can check for it. restoreAllCards o Restore all the cards that are restorable. o To restore a Card, add a random integer from [1, 10] to the current condition. o Print each Card that was restored on a new line in the format Restored to {newCondition}: {card}. Note that you must print out the card information before updating the Cards condition (i.e., the card should be printed with the old condition). o If no cards were restored, print out on a new line There were no cards to restore. battle o Given an index, battle using the Card at the index in the binder array by subtracting a random integer [1, 10] from the Cards current condition (remember that the condition has a minimum value of 40, so if subtracting the random integer makes it fall below this number, simply set condition to 40). o Print out the following statement on a new line using the data from the Card you just used in battle. o Your print statement should have the following format: Used: {card}. o If the index is invalid or the Card passed in is null, print out Cannot battle with a card at this spot. toString o This method will return a String representation of a Collection. o If there are no cards in the Collection, then the string must be formatted as follows: I own no cards!. o Otherwise, the string must be formatted as follows: I own {cardsOwned} cards. {card1} {card2} {card3} ... Note that you must print out all cards in the binder in the specified format. We are only showing until a hypothetical third card as an example. o The method String.format will be useful. Getters and setters only as necessary Any helper methods that you may need; ensure that these methods are not accessible outside of this class.
------------------------------
PokemonType.java This file defines a PokemonType enumeration. The only possible values it can have are NORMAL, FIRE, WATER, GRASS, or GROUND.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started