Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Add method listCard with int index parameter to print the card details of index

ID: 3594477 • Letter: A

Question

Add method listCard with int index parameter to print the card details of index in cards ArrayList in format “Card <index>: <card details>”:

if the indexValid(index), print card details of index (use .getDetails)

else print “Invalid index:   <index>”

Add method listCard with int index parameter to print the card details of index in cards ArrayList in format “Card <index>: <card details>”:

if the indexValid(index), print card details of index (use .getDetails)

else print “Invalid index:   <index>”

Explanation / Answer

public void listCard(int Index){ -->added method listCard

if(indexValid(index)){

System.out.println(cardsArrayList.get(index).getDetails()); --> Print card details if index valid

}

else {

System.out.println("Invalid Index: "+index); --> else print invalid index

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote