061_010 is a result of combining Rock and Country+ "The Song class This acts like a record for the song. The setter is missing for all the...
Question Get Answer

I really don't know what to do for this assignment.<br/>I don't know

where to put the .txt file in. I wrote the .txt's contents at the bottom.
Please help me to figure out :'(





https://www.coursehero.com/u/file/63869653/Week-04-lab-09-Songdocx/?justUnlocked=1#doc/qa




song.txt


Baby
Justin Bebier
3.35
Pop








song2.txt


Baby
Justin Bebier
3.35
Pop
Fearless
Taylor Swift
4.03
Pop


song3.txt


Baby
Justin Bebier
3.35
Pop
Fearless
Taylor Swift
4.03
Pop
Runaway Love
Ludacris
4.41
Pop


song4.txt


Baby
Justin Bebier
3.35
Pop
Fearless
Taylor Swift
4.03
Pop
Runaway Love
Ludacris
4.41
Pop
My Heart Will Go On
Celine Dion
4.41
Pop
Jesus Take The Wheel
Carrie Underwood
3.31
Country
If Tomorrow Never Comes
Garth Brooks
3.40
Country
Set Fire To Rain
Adele
4.01
Soul
Don't You Remember
Adele
3.03
Soul
Signed Sealed Deliverd I'm Yours
Stevie Wonder
2.39
Soul
Just Another Night
Mick Jagger
5.15
Rock
Brown Sugar
Mick Jagger
3.50
Rock
All I Want Is You
Bono
6.30
Metal
Beautiful Day
Bono
4.08
Metal
Like A Rolling Stone
Bob Dylan
6.08
Rock
Just Like a Woman
Bob Dylan
4.51
Rock
Hurricane
Bob Dylan
8.33
Rock
Subterranean Homesick Blues
Bob Dylan
2.24
Rock
Tangled Up In Blue
Bob Dylan
5.40
Rock
Love Me
Elvis Presley
2.42
Rock
In The Getto
Elvis Presley
2.31
Rock
All Shook Up
Elvis Presley
1.54
Rock

2.png
e.g. 061_010 is a result of combining Rock and Country+
&quot;The Song class
This acts like a record for the song. The setter is missing for all the properties
Song+
Class+
Fields+
Properties+
+
&lt;property setter absent&gt;&gt; Artist : string+
+
&lt;property setter absent&gt;&gt; Title : string+
+
&lt;property setter absent&gt;&gt; Length : double+
+
&lt;property setter absent&gt;&gt; Genre : SongGenre+
Methods+
+ &lt;constructors&gt; Song(title : string, artist : string, length :
double, genre : SongGenre)+
+ ToString() : string+
- Description of the class members+
Fields+
There are no fields.+
. Properties:
This class comprise of four auto-implemented properties with public getters and setters absent.
See the UML class diagram above for more details.+
- Constructor:
public Song(string title, string artist, double length, SongGence genre)
- This constructor that takes four arguments and assigns them to the appropriate properties.+
3.png
- Method:+
public override string ToString() -This public method overrides the ToString ()
method of the object class. It does not take any argument and returns a string representation of
the object. See the output for hints on the return value of this method.+
&quot;The Library class+
This is the front end of the application. This is a static class therefore all the members also have to
be static. Remember class members are accessed using the type instead of object reference.+
i Library+
Static Class+
i Fields+
songs : List&lt;Song&gt;+
Methods+
T
$+ LoadSongs (filename : string, ) : void+
t
$+ DisplaySongs() : void+
$+ DisplaySongs (longerThan : double) : void+
$+ DisplaySongs (genre : SongGenre) : void+
$+ DisplaySongs (artist : string) : void+
- Description of class members+
&quot;Fields:
songs - this private field is a list of song object is a class variable.+
- Properties:
There are no properties.+
- Constructor:
There is no constructor for this class.+
- Methods+
There are four over-loaded methods. Remember that overloading is a technique used to reduce
the complexity of the API exposed by the Song class.+
Here a foreach loop is
D.K.R.
recommended for all of theages of +
overloaded DisplaySongs
methods...
4.png
Here a foreach loop is
n.k.n.
recommended for all of theage 3 of +
overloaded DisplaySongs
methods...
Programming II
Song: file 10, static class
public static void DisplaySongs () - This is a public class method that does not take any
argument and displays all the songs in the collection.+
public static void DisplaySongs (double longerThan) - This is a public class method
that takes a double argument and displays only songs that are longer than the argument.+
public static void DisplaySongs (SongGence genre ) - This is a public class method
that takes a SongGence argument and displays only songs that are of this genre.+
public static void DisplaySongs (string artist ) - This is a public class method that
takes a string argument and displays only songs by this artist.+
public static void LoadSongs (string fileName) - This a class method that is public. It
takes a single string argument that represents a text file containing a collection of songs. You will
read all the data and create songs and add it to the songs
collection. Examine the contents of the files for a better
understanding of how this should be done. You will have to
The contents of text file+
read four lines to create one Song. Your loop body should
Baby..
have four ReadLine(). The recipe below might clarify things:..
Justin Bebier.
3.35.
Pop ..
. .
Initialize the songs field to a new List of Song+
Declare four string variable (title, artist, length, genre) to store the results of four
reader ReadLine().+
.
The first ReadLine() is a string representing the title of the song. This can and should
used as a check for termination condition. If this is empty then there are no more songs to
read i.e. it is the end of the file+
The next ReadLine ( ) will get the Artist+
The next ReadLine ( ) will be a string that
This is a complex method and
represents the weight. Use the
rightfully it should be a part of
Convert ToDouble to get the requiredtype+
the Song Class
.
The next ReadLine( ) will be a string that
represents the genre. Use the Enum Parse ( ) to get the requiredtype+
Use the above four variables to create a Song object.+
Add the newly created object to the collection.+
And finally do one more read for the title to re-enter the loop.+
P.S. Before running the Library.LoadSongs() you will need to copy the files song.txt, song2.txt,
song3.txt and song4.txt to the bin\debug folder.+
5.png
- Test Harness+
Insert the following code statements in the Main () method of your Program.cs file:+
Page 4 of 6+
Programming II
Song: file 10, static class
//To test the constructor and the JoString method.,
Console Miteline(new Song(&quot;Baby&quot;, &quot;Justin Bebier&quot;, 3.35, Songgenre.FOR) );.
//This is first time that you are using the bitwise or. It is used to specify a
combination of genres.,
Console. Mriteline(new Song( &quot;The Promise&quot;, &quot;chris Cornell&quot;, 4.26, Songgenre, Country I
SongGenre. Rock)) ;.
Library LoadSongs(&quot;songs4.txt&quot;);
Console. MriteLine(&quot;\\All songs&quot;);
//Class methods are invoke with the class name.
Library Displaysongs(;.
Sonegenre genre = Songgenre.Rock;..
Console MiteLine($&quot; \\n{genre} songs&quot;);.
Library Displaysongs (genre);.
string artist = &quot;Bob Dylan&quot;;..
Console MriteLine($&quot;\\songs by {artist}&quot;);.
Library Displaysongs (artist);..
double length = 5.0;.,
Console MiteLine($&quot; \\songs more than {length}mins&quot;);..
Library Displaysongs (length) ;..
6.png
&quot; Program output+
Baby by Justin Bebier (Pop) 3.35min..
The Promise by Chris Cornell (Rock, Country) 4. 26min..
All songs..
Baby by Justin Bebier (Pop) 3.35min.,
Fearless by Taylor Swift (Pop) 4.03min.,
Runaway Love by Ludacris (Pop) 4.41min.
My Heart Will Go On by Celine Dion (Pop) 4.41min..
Jesus Take The Wheel by Carrie Underwood (Country ) 3.31min.,
If Tomorrow Never Comes by Garth Brooks (Country) 3.40min..
Set Fire To Rain by Adele (Soul) 4.01min..
Don't You Remember by Adele (Soul) 3.03min.
Signed Sealed Deliverd I'm Yours by Stevie Wonder (Soul) 2.39min.,
Just Another Night by Mick Jagger (Rock) 5. 15min.,
Brown Sugar by Mick Jagger (Rock) 3.50min..
All I Want Is You by Bono (Metal) 6.30min.
Beautiful Day by Bono (Metal) 4.08min.,
Like A Rolling Stone by Bob Dylan (Rock) 6.08min.,
Just Like a Woman by Bob Dylan (Rock) 4. 51min.,
Hurricane by Bob Dylan (Rock) 8. 33min..
Subterranean Homesick Blues by Bob Dylan (Rock) 2. 24min..
Tangled Up In Blue by Bob Dylan (Rock) 5. 40min.,
Love Me by Elvis Presley (ROCK) 2.42min..
In The Getto by Elvis Presley (Rock) 2.31min..
All Shook Up by Elvis Presley (Rock) 1.54min.,
Rock songs..
Just Another Night by Mick Jagger (Rock) 5. 15min.,
Brown Sugar by Mick Jagger (Rock) 3.50min..
Like A Rolling Stone by Bob Dylan (Rock) 6.05min..
Just Like a Woman by Bob Dylan (Rock) 4.51min.,
Hurricane by Bob Dylan (Rock) 8. 33min..
Subterranean Homesick Blues by Bob Dylan (Rock) 2. 24min.,
Tangled Up In Blue by Bob Dylan (Rock) 5. 40min..
Love Me by Elvis Presley (ROCK) 2.42min.,
In The Getto by Elvis Presley (Rock) 2.31min..
All shook Up by Elvis Presley (Rock) 1.54min.,
Songs by Bob Dylan..
Like A Rolling Stone by Bob Dylan (Rock) 6.08min..
Just Like a Woman by Bob Dylan (Rock) 4. 51min..
Hurricane by Bob Dylan (Rock) 8. 33min..
Subterranean Homesick Blues by Bob Dylan (Rock) 2. 24min..
Tangled Up In Blue by Bob Dylan (Rock) 5. 40min..
Songs more than 5mins.
Just Another Night by Mick Jagger (Rock) 5. 15min..
All I Want Is You by Bono (Metal) 6.30min.,
Like A Rolling Stone by Bob Dylan (Rock) 6.68min..
Hurricane by Bob Dylan (Rock) 8.33min..
Tangled Up In Blue by Bob Dylan (Rock) 5. 40min.,
Press any key to continue

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Software engineering tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes