Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Here is pseudocode that goes inside the method: Method header: public ConcertTicket remove() { // Create a ConcertTicket reference variable (DO NOT create a new
Here is pseudocode that goes inside the method:
Method header:
public ConcertTicket remove() {
// Create a ConcertTicket reference variable (DO NOT create a new ConcertTicket JUST create the reference variable)
ConcertTicket ticket = null;
if (this.size > 0) {
// TODO Use the size variable (which always points at the next empty
// slot) to get the last added ConcertTicket from the array:
// TODO Set that array slot to null:
// TODO Decrement the size variable:
}
// Return the ConcertTicket:
return ticket;
}
4. Your job is to write a method that removes a ConcertTicket from the wallet and returns it. The method should be called remove. It should take no parameters, but it should return the most recently added Concert Ticket. Here is pseudocode that goes inside the method: Method header: public ConcertTicket remove() { // Create a ConcertTicket reference variable (DO NOT create a new Concert Ticket - JUST create the reference variable) ConcertTicket ticket = null; if (this.size > 0) { // TODO Use the size variable (which always points at the next empty // slot) to get the last added Concertticket from the array: // TODO Set that array slot to null: // TODO Decrement the size variable: } // Return the ConcertTicket: return ticket; 3Step 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