Add the three classic operations of Queues in the MagazineList.java to make it become a queue. Add testing code in MagazineRack.java to test your code. (You do not need to modify Magazine.java)
Add the three classic operations of Queues in the MagazineList.java to make it become a queue. Add testing code in MagazineRack.java to test your code. (You do not need to modify Magazine.java)
Magazine.java :
public class Magazine
{
private String title;
//-----------------------------------------------------------------
// Sets up the new magazine with its title.
//-----------------------------------------------------------------
public Magazine(String newTitle)
{
title = newTitle;
}
//-----------------------------------------------------------------
// Returns this magazine as a string.
//-----------------------------------------------------------------
public String toString()
{
return title;
}
}
MagazineList.java : attached the image below
MagazineRack.java:
public class MagazineRack
{
//----------------------------------------------------------------
// Creates a MagazineList object, adds several magazines to the
// list, then prints it.
//----------------------------------------------------------------
public static void main(String[] args)
{
MagazineList rack = new MagazineList();
rack.add(new Magazine("Time"));
rack.add(new Magazine("Woodworking Today"));
rack.add(new Magazine("Communications of the ACM"));
rack.add(new Magazine("House and Garden"));
rack.add(new Magazine("GQ"));
System.out.println(rack);
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images