Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create the class Random: Ask and check for user name Ask for month of birth (use

ID: 3592074 • Letter: C

Question

Create the class Random:

Ask and check for user name

Ask for month of birth (use a switch)

For Jan, Apr, Jul, and Oct, say "Go Dodgers!"

For Feb, May, Aug, and Nov, say "Go Steelers!"

For Mar, Jun, Sep, and Dec, say "Go Bernie!"

Ask user for favorite non-negative number

For even numbers, say "blah"

For odd numbers, say "oops!"

At the end, show user his/her inputs

The code must:

Use dialog boxes to allow user input and messages to the user

Use While loops to check for invalid user inputs (e.g., empty strings, strings instead of numbers or vice-versa, negative numbers, floats instead of integers or vice-versa, etc.)

Explanation / Answer

//Song Class

#ifndef SONG_CLASS

#define SONG_CLASS

using namespace std;

class Song

{

private:

        string title; //dynamic allocation

        string album;

        string genre;

        string artist;

        double durationn;

public:

        Song();

        void setTitle(string t);

        void setDuration(double d);

        void setAlbumName(string a);

        void setGenre(string g);

        void setArtist(string a);

        string getTitle();

        string getAlbum()const;

        string getGenre()const;

        string getArtist()const;

        double getDuration)(); //accessor

};

//constructor

Song::Song() //constructor

{

        title="";

        album="";

        genre="";

        artist="";

        duration=0;

}

//accessor for name

string Song::getTitle()

{

return title;

}

//mutator

void Song::setTitle(string t)

{

title=t;

}

//accessor for name

string Song::getAlbum()

{

return album;

}

//mutator

void Song::setAlbumName(string a)

{

album=a;

}

//accessor for name

string Song::getGenre()

{

return genre;

}

//mutator

void Song::setGenre(string g)

{

genre=g;

}

//accessor for name

string Song::getArtist()

{

return artist;

}

//mutator

void Song::setArtist(string s)

{

artist=s;

}

void Song::setDuration(double d)

{

duration=d;

}

double Song::getDuration()

{

return duration;

}

#endif   // SONG_CLASS

//FOR THE .CPP

I DO NOT KNOW HOW TO DISPLAY IT THERE.

CAN ANYONE HELP?

//file test.cpp

#include <iostream>

#include <fstream>

#include <string>

#include "song.h"

using namespace std;

int main()

{

        return 0;

}

Edit & Run

//Song Class

#ifndef SONG_CLASS

#define SONG_CLASS

using namespace std;

class Song

{

private:

        string title; //dynamic allocation

        string album;

        string genre;

        string artist;

        double durationn;

public:

        Song();

        void setTitle(string t);

        void setDuration(double d);

        void setAlbumName(string a);

        void setGenre(string g);

        void setArtist(string a);

        string getTitle();

        string getAlbum()const;

        string getGenre()const;

        string getArtist()const;

        double getDuration)(); //accessor

};

//constructor

Song::Song() //constructor

{

        title="";

        album="";

        genre="";

        artist="";

        duration=0;

}

//accessor for name

string Song::getTitle()

{

return title;

}

//mutator

void Song::setTitle(string t)

{

title=t;

}

//accessor for name

string Song::getAlbum()

{

return album;

}

//mutator

void Song::setAlbumName(string a)

{

album=a;

}

//accessor for name

string Song::getGenre()

{

return genre;

}

//mutator

void Song::setGenre(string g)

{

genre=g;

}

//accessor for name

string Song::getArtist()

{

return artist;

}

//mutator

void Song::setArtist(string s)

{

artist=s;

}

void Song::setDuration(double d)

{

duration=d;

}

double Song::getDuration()

{

return duration;

}

#endif   // SONG_CLASS

//FOR THE .CPP

I DO NOT KNOW HOW TO DISPLAY IT THERE.

CAN ANYONE HELP?

//file test.cpp

#include <iostream>

#include <fstream>

#include <string>

#include "song.h"

using namespace std;

int main()

{

        return 0;

}

Edit & Run

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote