subject

Please help! Consider this implementation of the class Card, that stores information related to a cards monetary value, name, condition, and number in a set of collectible cards:

public class Card
{
private double value;
private String name;
private int setNum; //each card has its own, unique setNum
private String condition;

public Card (String nom, String cond, double val, int numSet){
name = nom;
condition = cond;
value = val;
setNum = numSet;
}
public String getName(){
return name;
}
public String getCondition(){
return condition;
}

public double getValue(){
return value;
}
public int getSetNum(){
return setNum;
}
public String toString()
{
return name + ":: " + setNum;
}
}

A subsequent class CardCollection has been created with the instance variable ArrayList collection that stores a collection of cards.
import java. util. ArrayList;

public class CardCollection
{
ArrayList collection;
double totalVal;

public CardCollection(ArrayList myColl)
{
collection = myColl;
}
public double totalValue()
{
// code intentionally left blank
// you will write this method in #1
}
public String checkPerfect()
{
// code intentionally left blank
// you will write this method in #2
}
public ArrayList orderNumerically()
{
System. out. println("Before sort: " + collection);
// code intentionally left blank
System. out. println("After sort: " + sortedCards);
return collection;
}
}

The driver class CardRunner is shown below:
import java. util. ArrayList;

public class CardRunner
{
public static void main (String[] args)
{
ArrayList x = new ArrayList ();
// you will write this code in #3
x. add(new Card("Downey", "new", 48.72, 7));
x. add(new Card("Jones", "perfect", 200, 5));
x. add(new Card("Smith", "perfect", 24.8, 3));
x. add(new Card("Peek", "good", 13.5, 1));
System. out. println("\nThe total value of my collection is: $" + // #4 );
System. out. println("\nMy perfect cards are: " + // code intentionally left blank);
System. out. println("\n" + // code intentionally left blank);

}
}

1) Write a method totalValue() for CardCollection which returns the total value of all cards in a card collection.
2) Write a method checkPerfect() for CardCollection that prints the name of the Cards in a collection that are in "perfect" condition. 3) Instantiate a CardCollection object which could be used to access methods from the CardCollection class.
4) Complete this programming statement from CardRunner
System. out. println("\nThe total value of my collection is: $" + // #4 );

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
question
Computers and Technology, 24.06.2019 00:00
Consider the series where in this problem you must attempt to use the ratio test to decide whether the series converges. compute enter the numerical value of the limit l if it converges, inf if it diverges to infinity, minf if it diverges to negative infinity, or div if it diverges but not to infinity or negative infinity.
Answers: 1
question
Computers and Technology, 24.06.2019 02:00
How are we able to create photographs differently than 100 years ago? explain your answer in relation to your photograph you selected.
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Why is it uncommon for users to perform searches directly in database tables? a.)users are discouraged from interacting directly with tables because they might confuse tables with spreadsheets. b.) users are discouraged from interacting directly with tables because this may result in unintended changes to source data. c.)users do not have the technical skills required to perform searches directly in database tables. d.)users do not have the permissions required to perform searches directly in database tables.
Answers: 1
You know the right answer?
Please help! Consider this implementation of the class Card, that stores information related to a c...
Questions
question
Physics, 10.05.2021 19:50
question
Mathematics, 10.05.2021 19:50
question
Business, 10.05.2021 19:50
Questions on the website: 13722361