void printSong(Song);
int main() {
song1.title = "YYZ";
song1.artist = "Rush";
song1.yearRecorded = 1981;
song1.genre = "rock";
song1.lengthMin = 4;
song1.lengthSec = 25;
printSong(song1);
return 0;
}
void printSong(Song s) {
cout << s.title <<
" By " << s.artist
<<
" (" << s.yearRecorded
<< ")" <<
" [" << s.genre <<
"]" <<
" {" << s.lengthMin
<< ((s.lengthSec < 10) ? ":0" : ":") << s.lengthSec
<< "} " << endl;
}
struct MixTape {
string title;
Song track1;
Song track2;
Song track3;
Song track4;
Song track5;
Song track6;
Song track7;
Song track8;
int totalLengthMin;
int totalLengthSec;
} myMixTape;
c++
a)
Code:
#include <iostream>
using namespace std;
struct Song{
string title;
string artist;
int yearRecorded;
string genre;
int lengthMin;
int lengthSec;
};
int main(){
Song song1,song2,song3,song4,song5,song6,song7,song8;
return 0;
}
Code screenshot:

Output (Since it is just the declaration of objects,so the output is blank as shown below):

b) Code after integrating the test code:
#include <iostream>
using namespace std;
struct Song{
string title;
string artist;
int yearRecorded;
string genre;
int lengthMin;
int lengthSec;
};
void printSong(Song);
int main(){
Song song1,song2,song3,song4,song5,song6,song7,song8;
song1.title = "YYZ";
song1.artist = "Rush";
song1.yearRecorded = 1981;
song1.genre = "rock";
song1.lengthMin = 4;
song1.lengthSec = 25;
printSong(song1);
return 0;
}
void printSong(Song s) {
cout << s.title <<
" By " << s.artist <<
" (" << s.yearRecorded << ")" <<
" [" << s.genre << "]" <<
" {" << s.lengthMin << ((s.lengthSec < 10) ? ":0" :
":") << s.lengthSec << "} " << endl;
}
Code screenshot:

Output:

c)
Code:
#include <iostream>
using namespace std;
struct Song{
string title;
string artist;
int yearRecorded;
string genre;
int lengthMin;
int lengthSec;
};
void printSong(Song);
int main(){
Song song1,song2,song3,song4,song5,song6,song7,song8;
song1.title = "YYZ";
song1.artist = "Rush";
song1.yearRecorded = 1981;
song1.genre = "rock";
song1.lengthMin = 4;
song1.lengthSec = 25;
song2.title = "The Requiem";
song2.artist = "Linkin Park";
song2.yearRecorded = 2010;
song2.genre = "rock";
song2.lengthMin = 2;
song2.lengthSec = 21;
song3.title = "The Radiance";
song3.artist = "Linkin Park";
song3.yearRecorded = 2010;
song3.genre = "rock";
song3.lengthMin = 0;
song3.lengthSec = 57;
song4.title = "Burning In The Skies";
song4.artist = "Linkin Park";
song4.yearRecorded = 2010;
song4.genre = "rock";
song4.lengthMin = 4;
song4.lengthSec = 13;
song5.title = "Empty Spaces";
song5.artist = "Linkin Park";
song5.yearRecorded = 2010;
song5.genre = "rock";
song5.lengthMin = 0;
song5.lengthSec = 18;
song6.title = "When They Come For Me";
song6.artist = "Linkin Park";
song6.yearRecorded = 2010;
song6.genre = "rock";
song6.lengthMin = 4;
song6.lengthSec = 55;
song7.title = "Waiting For The End";
song7.artist = "Linkin Park";
song7.yearRecorded = 2010;
song7.genre = "rock";
song7.lengthMin = 3;
song7.lengthSec = 51;
song8.title = "Wretches And Kings";
song8.artist = "Linkin Park";
song8.yearRecorded = 2010;
song8.genre = "rock";
song8.lengthMin = 4;
song8.lengthSec = 15;
printSong(song1);
printSong(song2);
printSong(song3);
printSong(song4);
printSong(song5);
printSong(song6);
printSong(song7);
printSong(song8);
return 0;
}
void printSong(Song s) {
cout << s.title <<
" By " << s.artist <<
" (" << s.yearRecorded << ")" <<
" [" << s.genre << "]" <<
" {" << s.lengthMin << ((s.lengthSec < 10) ? ":0" :
":") << s.lengthSec << "} " << endl;
}
Code screenshot:



Output:

d)
Code (just added the new MixTape Structure with rest of the code remain same as demanded in the question):
#include <iostream>
using namespace std;
struct Song{
string title;
string artist;
int yearRecorded;
string genre;
int lengthMin;
int lengthSec;
};
struct MixTape {
string title;
Song track1;
Song track2;
Song track3;
Song track4;
Song track5;
Song track6;
Song track7;
Song track8;
int totalLengthMin;
int totalLengthSec;
} myMixTape;
void printSong(Song);
int main(){
Song song1,song2,song3,song4,song5,song6,song7,song8;
song1.title = "YYZ";
song1.artist = "Rush";
song1.yearRecorded = 1981;
song1.genre = "rock";
song1.lengthMin = 4;
song1.lengthSec = 25;
song2.title = "The Requiem";
song2.artist = "Linkin Park";
song2.yearRecorded = 2010;
song2.genre = "rock";
song2.lengthMin = 2;
song2.lengthSec = 21;
song3.title = "The Radiance";
song3.artist = "Linkin Park";
song3.yearRecorded = 2010;
song3.genre = "rock";
song3.lengthMin = 0;
song3.lengthSec = 57;
song4.title = "Burning In The Skies";
song4.artist = "Linkin Park";
song4.yearRecorded = 2010;
song4.genre = "rock";
song4.lengthMin = 4;
song4.lengthSec = 13;
song5.title = "Empty Spaces";
song5.artist = "Linkin Park";
song5.yearRecorded = 2010;
song5.genre = "rock";
song5.lengthMin = 0;
song5.lengthSec = 18;
song6.title = "When They Come For Me";
song6.artist = "Linkin Park";
song6.yearRecorded = 2010;
song6.genre = "rock";
song6.lengthMin = 4;
song6.lengthSec = 55;
song7.title = "Waiting For The End";
song7.artist = "Linkin Park";
song7.yearRecorded = 2010;
song7.genre = "rock";
song7.lengthMin = 3;
song7.lengthSec = 51;
song8.title = "Wretches And Kings";
song8.artist = "Linkin Park";
song8.yearRecorded = 2010;
song8.genre = "rock";
song8.lengthMin = 4;
song8.lengthSec = 15;
printSong(song1);
printSong(song2);
printSong(song3);
printSong(song4);
printSong(song5);
printSong(song6);
printSong(song7);
printSong(song8);
return 0;
}
void printSong(Song s) {
cout << s.title <<
" By " << s.artist <<
" (" << s.yearRecorded << ")" <<
" [" << s.genre << "]" <<
" {" << s.lengthMin << ((s.lengthSec < 10) ? ":0" :
":") << s.lengthSec << "} " << endl;
}
Code screenshot:



Ouput (Same as above and compiled successfully after adding MixTape structure):

e)
Code:
#include <iostream>
using namespace std;
struct Song{
string title;
string artist;
int yearRecorded;
string genre;
int lengthMin;
int lengthSec;
};
struct MixTape {
string title;
Song track1;
Song track2;
Song track3;
Song track4;
Song track5;
Song track6;
Song track7;
Song track8;
int totalLengthMin;
int totalLengthSec;
} myMixTape;
void printSong(Song);
void printMixTape(MixTape);
int main(){
Song song1,song2,song3,song4,song5,song6,song7,song8;
song1.title = "YYZ";
song1.artist = "Rush";
song1.yearRecorded = 1981;
song1.genre = "rock";
song1.lengthMin = 4;
song1.lengthSec = 25;
song2.title = "The Requiem";
song2.artist = "Linkin Park";
song2.yearRecorded = 2010;
song2.genre = "rock";
song2.lengthMin = 2;
song2.lengthSec = 21;
song3.title = "The Radiance";
song3.artist = "Linkin Park";
song3.yearRecorded = 2010;
song3.genre = "rock";
song3.lengthMin = 0;
song3.lengthSec = 57;
song4.title = "Burning In The Skies";
song4.artist = "Linkin Park";
song4.yearRecorded = 2010;
song4.genre = "rock";
song4.lengthMin = 4;
song4.lengthSec = 13;
song5.title = "Empty Spaces";
song5.artist = "Linkin Park";
song5.yearRecorded = 2010;
song5.genre = "rock";
song5.lengthMin = 0;
song5.lengthSec = 18;
song6.title = "When They Come For Me";
song6.artist = "Linkin Park";
song6.yearRecorded = 2010;
song6.genre = "rock";
song6.lengthMin = 4;
song6.lengthSec = 55;
song7.title = "Waiting For The End";
song7.artist = "Linkin Park";
song7.yearRecorded = 2010;
song7.genre = "rock";
song7.lengthMin = 3;
song7.lengthSec = 51;
song8.title = "Wretches And Kings";
song8.artist = "Linkin Park";
song8.yearRecorded = 2010;
song8.genre = "rock";
song8.lengthMin = 4;
song8.lengthSec = 15;
myMixTape.title="My Mix Tape";
myMixTape.track1=song1;
myMixTape.track2=song2;
myMixTape.track3=song3;
myMixTape.track4=song4;
myMixTape.track5=song5;
myMixTape.track6=song6;
myMixTape.track7=song7;
myMixTape.track8=song8;
myMixTape.totalLengthMin = song1.lengthMin + song2.lengthMin
+
song3.lengthMin + song4.lengthMin +
song5.lengthMin + song6.lengthMin +
song7.lengthMin + song8.lengthMin;
// totalSeconds in a temp variable .
// totalSeconds / 60 gives extra minutes.
// totalSeconds % 60 gives the remaining seconds.
int totalSeconds = song1.lengthSec + song2.lengthSec +
song3.lengthSec + song4.lengthSec +
song5.lengthSec + song6.lengthSec +
song7.lengthSec + song8.lengthSec;
myMixTape.totalLengthMin = myMixTape.totalLengthMin +
totalSeconds/60;
myMixTape.totalLengthSec = totalSeconds%60;
printSong(song1);
printSong(song2);
printSong(song3);
printSong(song4);
printSong(song5);
printSong(song6);
printSong(song7);
printSong(song8);
return 0;
}
void printSong(Song s) {
cout << s.title <<
" By " << s.artist <<
" (" << s.yearRecorded << ")" <<
" [" << s.genre << "]" <<
" {" << s.lengthMin << ((s.lengthSec < 10) ? ":0" :
":") << s.lengthSec << "} " << endl;
}
Code Screenshots:



Output (No changes same as previous one. You may print totalLengthMin and totalLengthSec to see the changes):

The given question has many part So I have solved 5 parts.
Have a great day ahead !
Question on struct Write a struct called Song. Song will have the data members string title,...
Introduction In this final programming exercise, you'll get a chance to put together many of the techniques used during this semester while incorporating OOP techniques to develop a simple song playlist class. This playlist class allows a user to add, remove and display songs in a playlist. The Base Class, Derived Class and Test Client Unlike the other PAs you completed in zyLabs, for this PA you will be creating THREE Java files in IntelliJ to submit. You will need...
public class Song {
private String title;
private String artist;
private int duration;
public Song() {
this("", "", 0, 0);
}
public Song(String t, String a, int m, int s) {
title = t;
artist = a;
duration = m * 60 + s;
}
public String getTitle() { return title; }
public String getArtist() { return artist; }
public int getDuration() { return duration; }
public int getMinutes() {
return duration / 60;
}
public int getSeconds() {
return...
Using C++ write the following program: 1) For the song program below, on a separate line write a function to quickly print the list of Streaming Services in your Song class, do not modify the program. 2). The Duration in your Song class contains minutes and seconds. Create a data structure called Duration to group the data, do not modify the program but with it on a separate line. #include<iostream> using namespace std; struct Song { string song_title; ...
Hi I've a problem with this code. When I add more than 1 song to the list, it doesn't show the first one, only shows the latest one, when I called the function displaysong, let's say when you add 2 songs ID 1 then ID 2, it shows only ID 1. Can you fix it. Everything else is fine.. #include <iostream> #include<string> using namespace std; //class Song class Song{ private: int songID; string title; string artist; string album; int year; public:...
Task #3 Arrays of Objects 1. Copy the files Song java (see Code Listing 7.1), Compact Disc.java (see Code Listing 7.2) and Classics.txt (see Code Listing 7.3) from the Student Files or as directed by your instructor. Song.java is complete and will not be edited. Classics.txt is the data file that will be used by Compact Disc.java, the file you will be editing. 2. In Compact Disc.java, there are comments indicating where the missing code is to be placed. Declare...
Objectives: GUI Tasks: In Lab 4, you have completed a typical function of music player -- sorting song lists. In this assignment, you are asked to design a graphic user interface (GUI) for this function. To start, create a Java project named CS235A4_YourName. Then, copy the class Singer and class Song from finished Lab 4 and paste into the created project (src folder). Define another class TestSongGUI to implement a GUI application of sorting songs. Your application must provide the...
Write the following method definitions for the DLL class:
(5 pt) void push(string t, string a, int m, int s);
This pushes a new node onto the end of
the list. If there are no nodes in the list, it creates the first
node and adds it. Otherwise it places a new node onto the end of
the list. t is the song’s title,a is the song’s artist, m is the
number of minutes the song runs for, and s...
Many of us have large digital music collections that are not
always very well organized. It would be nice to have a program that
would manipulate our music collection based on attributes such as
artist, album title, song title, genre, song length, number times
played, and rating. For this assignment you will write a basic
digital music manager (DMM). Your DMM program must have a
text-based interface which allows the user to select from a main
menu of options including:...
The task is to write Song.cpp to complete the implementation of the Song class, as defined in the provided header file, Song.h, and then to complete a program (called sales) that makes use of the class. As in Project 1, an input data file will be provided containing the song name and other information in the same format as in Program 1: Artist Song_Title Year Sales Medium As before, the program (sales) which are individual copies, will use this information to compute the gross...
Ch 8 Program: Playlist (Java)You will be building a linked list. Make sure to keep track of both the head and tail nodes.(1) Create two files to submit.SongEntry.java - Class declarationPlaylist.java - Contains main() methodBuild the SongEntry class per the following specifications. Note: Some methods can initially be method stubs (empty methods), to be completed in later steps.Private fieldsString uniqueID - Initialized to "none" in default constructorstring songName - Initialized to "none" in default constructorstring artistName - Initialized to "none"...