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, 24.06.2019 00:00
Which tool could be used to display only rows containing presidents who served two terms
Answers: 3
question
Computers and Technology, 24.06.2019 11:30
What does the https: // mean when you type in a website
Answers: 1
question
Computers and Technology, 25.06.2019 08:10
Which of the following statements is false? a. package access is rarely used. b. use the access modifier package to give a method or variable package access. c. classes in the same source file are part of the same package. d. if a program uses multiple classes from the same package, these classes can access each other's package access members directly through references to objects of the appropriate classes, or in the case of static members, through the class name.
Answers: 1
question
Computers and Technology, 25.06.2019 10:20
(programming exercise 3-10). a retail company must file a monthly sales tax report listing the total sales for the month, and the amount of state and county sales tax collected. the state sales tax rate is 4 percent and the county sales tax rate is 2 percent. design a modular program that asks the user to enter the total sales for the month. from this figure, the application should calculate and display the following: - the amount of county sales tax - the amount of states sales tax - the total sales tax (county plus state) some of the code has already been provided below. complete the missing code below. // global constants for tax calculations constant real county_tax_rate = .02 constant real state_tax_rate = .04 // main module module main() // local variables declare real monthsales, countytax, statetax // get month sales display “enter monthly sales: ” input monthsales // write the statement to calculate county tax // write the statement to calculate state tax // display tax amount call showtaxes(monthsales, countytax, statetax) end module // the showtaxes module accepts monthsales, countytax, statetax // as arguments and displays the resulting data // write the showtaxes module
Answers: 2
You know the right answer?
Please help! Consider this implementation of the class Card, that stores information related to a c...
Questions
question
English, 05.07.2021 23:10
question
Mathematics, 05.07.2021 23:10
question
Social Studies, 05.07.2021 23:10
question
Mathematics, 05.07.2021 23:20
question
Mathematics, 05.07.2021 23:20
question
Health, 05.07.2021 23:20
question
Social Studies, 05.07.2021 23:20
Questions on the website: 13722362