Create a class of songs. The class should be called Song and each object in this class represents a song. (This class could be used, for example, in a music library.) Each song has a title, an artist and a recording year. The title and artist are strings and both can consist of multiple words. The year is an integer. Your class should be designed by using the principle of encapsulation. In other words, the data should be private. Create the following operations for this class of objects: (a) A function print(s, out) that prints song s to output stream out in the following format: Title Artist Year 1 Three complete lines are printed. The stream argument has cout as a default value. (b) A function read(s, in) that reads song s from input stream in. The data in the stream is assumed to be in the format specified for print. In particular, three complete lines are read. No errorchecking is performed. The stream argument has cin as a default value. (c) A function equals(s1, s2) that returns true if the songs s1 and s2 have the same title, artist and recording year. (The return value should be a Boolean value, not a string.) Note that these functions should be standalone functions, not methods or member functions. The above describes the arguments of the various functions but not how these arguments are passed to the functions. Part of what you have to do is decide how these arguments should be passed. Make sure to think about it carefully taking into account the discussion we had in class. Consult the notes. Write (and submit) a test driver for your class and its operations. Make sure you test all three functions. 2. Modify the class Song you created for the previous exercise by doing the following: (a) Replace the function print(s, out) by a method print(out) that prints the song to output stream out in the same format as before: 2 Title Artist Year Three complete lines are printed. The argument has cout as a default value. (b) Replace the function read(s, in) by a method read(in) that reads the song from input stream in. The data in the stream is assumed to be in the format specified for print. In particular, three complete lines are read. The argument has cin as a default value. No error-checking is performed. Write (and submit) a test driver for your class

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Can you help me write a program for this please:

Create a class of songs. The class should be called Song and each
object in this class represents a song. (This class could be used, for example, in a music library.) Each song has a title, an artist and a recording
year. The title and artist are strings and both can consist of multiple words.
The year is an integer.
Your class should be designed by using the principle of encapsulation. In
other words, the data should be private.
Create the following operations for this class of objects:
(a) A function print(s, out) that prints song s to output stream out
in the following format:
Title
Artist
Year
1
Three complete lines are printed. The stream argument has cout as
a default value.
(b) A function read(s, in) that reads song s from input stream in.
The data in the stream is assumed to be in the format specified
for print. In particular, three complete lines are read. No errorchecking is performed. The stream argument has cin as a default
value.
(c) A function equals(s1, s2) that returns true if the songs s1 and
s2 have the same title, artist and recording year. (The return value
should be a Boolean value, not a string.)
Note that these functions should be standalone functions, not methods or
member functions.
The above describes the arguments of the various functions but not how
these arguments are passed to the functions. Part of what you have to do is
decide how these arguments should be passed. Make sure to think about
it carefully taking into account the discussion we had in class. Consult the
notes.
Write (and submit) a test driver for your class and its operations. Make
sure you test all three functions.
2. Modify the class Song you created for the previous exercise by
doing the following:
(a) Replace the function print(s, out) by a method print(out)
that prints the song to output stream out in the same format as before:
2
Title
Artist
Year
Three complete lines are printed. The argument has cout as a default value.
(b) Replace the function read(s, in) by a method read(in) that
reads the song from input stream in. The data in the stream is assumed to be in the format specified for print. In particular, three
complete lines are read. The argument has cin as a default value.
No error-checking is performed.
Write (and submit) a test driver for your class

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

I am having trouble running the code, it says there are a lot of errors and I am not sure I am even running it right. How would I go about running the code and fixing the errors in C++

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education