Question

In: Computer Science

Song struct to store the data for a single song (make it a private member), and you must have an array of Song structures as a member variable.

USE C++ 

Song struct to store the data for a single song (make it a private member), and you must have an array of Song structures as a member variable.

Player(string name, float size) a constructor for the class. ’name' is a name for it
'size' is a maximum capacity in Mb.

addSong(string band, string title, string length, float size) a function for adding a new song.

'band' is a name of the band
'title' is a name of the song
'length' is a time length of that song in a '1:23' format (“mm:ss") 'size' is a size of the song in Mb

Return true if the song was added and false if there was not enough space (memory) for it or there was a song with the same band and title already in that device or if the device already has 1000 songs in it.

removeSong(string band, string title) a function for removing a song 'band' is a name of the band
'title' is a name of the song

Return true if the song was successfully removed and false if it wasn't present on the device.

displaySongInfo(string band, string title) a function to display a song’s info in the following format:
Band:

Length:


Number of songs:
Total length:

Free space left:
The output must line up in two columns, but the labels may be right justified.

Solutions

Expert Solution

struct Song

{

private string band;

private string title;

private string length;

private float size;

}

class player

{

string nme;

float siz;

player(string name, float size)

{

nme=name;

siz=size;

}

}

public bool addSong(string band, string title, string length, float size)

{

if(band!=null)

{

if(size>1000)

{

return false;

}

if(title.exists())

{

return false;

}

}

Song s[10];

int song_count=0;

cout<<Ënter song to add";

for(int i=0;1;i

{

song[i+1]=song[i];

}

song_count+=1;

for(i=0;i<5;i++)

{

cin>>s[i].band;

cin>>s[i].legth;

cin>>s[i].title;

cin>>s[i].size;

}

}

public bool removeSong(string band, string title)

{

Song s[10];

int song_count=0;

cout<<Ënter song to delete";

for(int i=0;1;i

{

song[i-1]=song[i];

return true;

}

return false;

song_count-=1;

}

}

public displaySongInfo(string band, string title)

{

int song_count =10;

Song s[song_count];

for(int i=0;i

{

cout<

cout<<"Band:"<

cout<<"Tittle:"<

cout<<"Number of songs::"< cout<<"Total Length:"<

cout<<"TSize:"<

}

int main()

{

cout<< "add song details";

struct song s1,s2,s3;

s1.band = ""xxX"";

s1.title ="TiX";

s1.leght="23:2";

s1.size="23";

struct song s[5];

int i;

for(i=0;i<5;i++)

{

cin>>s[i].band;

cin>>s[i].legth;

cin>>s[i].title;

cin>>s[i].size;

}

char yesorno;

addSong(s1.band,s1.title,s1.length,s1.size);

cout<<"do you wnt to remove songy/n";

cin>>yesorno;

if(yesorno='y')

removeSong(s1.band,s1.title);

cout<<"do you want to display info(y/n)";

cin>>yesorno;

if(yesorno='y')

displaySongInfo(s1.band,s1.title);

}


Related Solutions

Declare a Song struct to store the data for a single song (make it a private member), and you must have anarray of Song structures as a member variable.
USE C++ Declare a Song struct to store the data for a single song (make it a private member), and you must have anarray of Song structures as a member variable.Player(string name, float size) a constructor for the class. ’name' is a name for it'size' is a maximum capacity in Mb.addSong(string band, string title, string length, float size) a function for adding a new song.'band' is a name of the band'title' is a name of the song'length' is a time length...
language c++(Data structure) You have to read a file and store a data in character array...
language c++(Data structure) You have to read a file and store a data in character array ( you cant initialize a character array, you have to code generically) code must be generic u must read a file onece u cant use built in function etc string, code in classes if u initialized a char array or ur code doesn't run i will dislike and report u you can use link list to store data
Write a program using multiple functions. Make use of an array to store data Make use...
Write a program using multiple functions. Make use of an array to store data Make use of searching techniques Read data from a file Write data to a file Instructions: In this lab, you will be examining a set of stock collected over a twenty four day period. Be sure to make use of an array to store these stocks. You will be required to read in the data points from a file. Write a function to read in the...
The Encrypt class has an integer private data member 8 element array named digits. The first four elements (0 ~ 3) are to store the original 4 digits integer and the next four (4 ~ 7) are to store the encrypted data
C++ Please Modify the code and create a new header fileA company wants to transmit data over the telephone, but is concerned that its phones could be tapped. All of the data are transmitted as four-digit integers. The company has asked you to write a program that encrypts the data so that it can be transmitted more securely. Your program should read a four-digit integer and encrypt it as follows: Replace each digit by (the sum of that digit plus...
Recall that for a random variable to be a binomial random variable, you must have an...
Recall that for a random variable to be a binomial random variable, you must have an experiment which meets the following three criteria: 1: There are exactly two outcomes for each trial. 2: There are a fixed number (n) of trials. 3: The trials are independent, and there is a fixed probability of success (p) and failure (q) for each trial. For each of the two situations described below, please indicate if the variable X (as defined in each situation)...
1. Define a class counterType to implement a counter. Your class must have a private data...
1. Define a class counterType to implement a counter. Your class must have a private data member counter of type int and functions to set counter to the value specified by the user, initialize counter to 0, retrieve the value of counter, and increment and decrement counter by one. The value of counter must be nonnegative. 2. Some of the characteristics of a book are the title, author(s), publisher, ISBN, price, and year of publication. Design a class bookType that...
(MUST BE DONE IN C (NOT C++)) In this task, you will have to make sure...
(MUST BE DONE IN C (NOT C++)) In this task, you will have to make sure you understood the concept of “the dot” in programming. Go ahead and declare an array of characters with a default length (whichever length you want, it's fine). Next, you want to ask the user for a phrase and store the characters in your array, but before you do that, ask the user for an estimated length of the array. If the length given is...
Write a C program that summarizes an order from a fictitious store. You must have these...
Write a C program that summarizes an order from a fictitious store. You must have these four lines in your program: float bike_cost, surfboard_cost; float tax_rate, tax_amount; int num_bikes, num_surfboards; float total_cost_bikes, total_cost_surfboards; float total_cost, total_amount_with_tax;
Write a C program that summarizes an order from a fictitious store. You must have these...
Write a C program that summarizes an order from a fictitious store. You must have these four lines in your program: float bike_cost, surfboard_cost; float tax_rate, tax_amount; int num_bikes, num_surfboards; float total_cost_bikes, total_cost_surfboards; float total_cost, total_amount_with_tax; You will assign your own unique values for each of the variables, except the totals which are computed. No other variables are needed in the program. For example, you will see the numbers I picked in my program in the sample output below. I...
Ben Graham stated that "if you want to make money on Wall Street, you must have...
Ben Graham stated that "if you want to make money on Wall Street, you must have the proper psychological attitude." Quoting the philosopher, Spinoza, Graham said "you must look at things in the aspect of eternity". What does this mean? How did this change Warren Buffet's life and the trajectory of investor psychology? And does this investment guidance hold true given the unprecedented swings in the stock market today?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT