Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following UML diagram for a class containing information about a song: This simple class has two member variables and four member functions to

Consider the following UML diagram for a class containing information about a song:

This simple class has two member variables and four member functions to set and get the variables.

it's like:

-name :string

-artist: string

+setName(n:string):void

+setArtist(a:string):void

+getName:string

+getArtist:string

  • setName should change member variable name to the parameter n
  • setArtist should change member variable artist to the parameter a
  • getName should return member variable name
  • getArtist should return member variable artist

Implement a complete C++ program which declares this class and implements all four of its member functions. Then, create a simple main() program which creates an object of the class, asks the user for name and artist, calls the set functions to assign reasonable values for name and artist, and then calls the get functions to output both name and artist to the console. You should do this all in one .cpp file.

Hint: to input strings that may contain spaces, use getline instead of cin

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_2

Step: 3

blur-text-image_3

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 Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

=+90 percent of all oil refineries) into several smaller companies

Answered: 1 week ago