Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question has been submitted before and answered in sufficiently. Please make sure output to the errorlog txt file is done and is formatted the

image text in transcribedimage text in transcribedThis question has been submitted before and answered in sufficiently. Please make sure output to the errorlog txt file is done and is formatted the same way as the input data. if one piece of a "song" has an issue the entire string of info should be passed the error log in that format. extra information outside of brackets or brackets non related can be ignored. Interface is below.

import java.util.EmptyStackException;

public class LinkedStack implements StackInterface { private Node topNode; public LinkedStack() { topNode = null; } private class Node { private T data; private Node next; private Node(T d, Node n) { data = d; next = n; } private T getData() { return data; } private Node getNextNode() { return next; } } @Override public void push(T newEntry) { topNode = new Node(newEntry, topNode); }

@Override public T pop() { if(isEmpty()) { throw new EmptyStackException(); } T top = topNode.getData(); topNode = topNode.getNextNode(); return top; }

@Override public T peek() { if(isEmpty()) { throw new EmptyStackException(); } return topNode.getData(); }

@Override public boolean isEmpty() { return topNode == null; }

@Override public void clear() { topNode = null; }

}

Write a Java class called Song to represent a song in a music collection. The data members of the Song class are String objects representing the song title, artist's name, and the album that includes the song. The instance variables for the class are to have private access modifiers, so you will need to write the appropriate methods to allow a client class to access and modify the data values. In accordance with good programming practice, you are to override the equals and toString methods inherited from Object. In addition, this class is going to be used in a future project collection that is to be sorted, so you'll need to implement the Comparable interface A second class is to be written called SongReader that contains a main method that reads in a file name via the command line. The file is a listing of the songs that have been formatted using angle-bracketed tags. For example, song song song <album> Melophobia</album> <title> The Trapeze Swinger Iron & Wine Young as the Morning, Old as the Sea Cigarette Daydreams Somebody's Love <artist> Passenger </artist> The Trapeze Swinger Single Cage the Elephant Each line will a tag (opening or closing), data, or a combination of these elements. Tags are matched pairs of single words surrounded by angle brackets. Opening tags begin with an angle bracket ( interface in your project for matching opening and closing tags. You do not have to implement the interface, you may use one of the implementations that we have discussed in class and can be found in the Stacks content area of Blackboard. You may not use any external Write a Java class called Song to represent a song in a music collection. The data members of the Song class are String objects representing the song title, artist's name, and the album that includes the song. The instance variables for the class are to have private access modifiers, so you will need to write the appropriate methods to allow a client class to access and modify the data values. In accordance with good programming practice, you are to override the equals and toString methods inherited from Object. In addition, this class is going to be used in a future project collection that is to be sorted, so you'll need to implement the Comparable interface A second class is to be written called SongReader that contains a main method that reads in a file name via the command line. The file is a listing of the songs that have been formatted using angle-bracketed tags. For example, song song song <album> Melophobia</album> <title> The Trapeze Swinger Iron & Wine Young as the Morning, Old as the Sea Cigarette Daydreams Somebody's Love <artist> Passenger </artist> The Trapeze Swinger Single Cage the Elephant Each line will a tag (opening or closing), data, or a combination of these elements. Tags are matched pairs of single words surrounded by angle brackets. Opening tags begin with an angle bracket ( interface in your project for matching opening and closing tags. You do not have to implement the interface, you may use one of the implementations that we have discussed in class and can be found in the Stacks content area of Blackboard. You may not use any external

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

Write formal and informal proposals.

Answered: 1 week ago

Question

Describe the components of a formal report.

Answered: 1 week ago

Question

Write formal and informal reports.

Answered: 1 week ago