Below for each class you find a UML and description of the public interface. Implementing the public interface as described is madatory. There's freedom on how to implement these classes.The private properties and private methods are under your control.. There are multiple ways of implementing all these classes. Feel free to add private properties and methods. For each object, it's mandatory to create a header file (.h), implementation file (.cpp) and a driver. Blank files are included. The header should have the class definition in it. The implementation file should contain the implementations of the methods laid out in the header fine. And finally the Driver should test/demonstrate all the features of the class. It's best to develop the driver as the class is being written. Check each section to see if there are added additional requirements for the driver. Two test suites are included so that work can be checked.  It's important to implement the drivers to test and demonstrate Classes functionality. SongTest.cpp :  #define CATCH_CONFIG_MAIN #include "../Song.h" #include #include TEST_CASE("Should be able to create a Song") {     Song *song = new Song("Bohemian Rhapsody", "Queen", 5, 54, "Rock", 1975); } TEST_CASE("Should be able to get the song title") {     Song song2("Shape of You", "Ed Sheeran", 3, 54, "Pop", 2017);     string title = song2.getTitle();     REQUIRE_THAT("Shape of You", Catch::Matchers::Equals(title)); } TEST_CASE("Should be able to get the song artist") {     Song song3("Imagine", "John Lennon", 3, 3, "Rock", 1971);     string title = song3.getArtist();     REQUIRE_THAT("John Lennon", Catch::Matchers::Equals(title)); } TEST_CASE("Should be able to get the song duration") {     Song song3("Imagine", "John Lennon", 3, 3, "Rock", 1971);     string duration = song3.getDuration();     REQUIRE_THAT("3:03", Catch::Matchers::Equals(duration)); } TEST_CASE("Should be able to get the song genre") {     Song song3("Imagine", "John Lennon", 3, 3, "Rock", 1971);     string genre = song3.getGenre();     REQUIRE_THAT("Rock", Catch::Matchers::Equals(genre)); } TEST_CASE("Should be able to get the song release year") {     Song song3("Imagine", "John Lennon", 3, 3, "Rock", 1971);     int releaseYear = song3.getReleaseYear();     REQUIRE(1971 == releaseYear); } TEST_CASE("Should be able to get a string representation of the song") {     Song *song = new Song("Bohemian Rhapsody", "Queen", 5, 54, "Rock", 1975);     CHECK_THAT(song->toString(), Catch::Matchers::ContainsSubstring("Bohemian Rhapsody"));     CHECK_THAT(song->toString(), Catch::Matchers::ContainsSubstring("Queen")); } TEST_CASE("Should be able to add a comment to a song") {     Song *song = new Song("Bohemian Rhapsody", "Queen", 5, 54, "Rock", 1975);     song->addComment("One of the greatest rock songs ever!"); } TEST_CASE("Outputting the Song as a string should include song's comments") {     Song *song = new Song("Bohemian Rhapsody", "Queen", 5, 54, "Rock", 1975);     song->addComment("One of the greatest rock songs ever!");     song->addComment("Amazing vocals!");     CHECK_THAT(song->toString(), Catch::Matchers::ContainsSubstring("One of the greatest rock songs ever!"));     CHECK_THAT(song->toString(), Catch::Matchers::ContainsSubstring("Amazing vocals!")); } Song.cpp: #include "Song.h", Song.h:  #include #include using namespace std; #ifndef SONG_H #define SONG_H   #endif //SONG_H,  SongDriver.cpp:  #include using namespace std; #include "Road.h" int main() {     std::cout << "Hello, Song Driver!" << std::endl;     return 0;

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 2RQ
icon
Related questions
Question

Below for each class you find a UML and description of the public interface. Implementing the public interface as described is madatory. There's freedom on how to implement these classes.The private properties and private methods are under your control.. There are multiple ways of implementing all these classes. Feel free to add private properties and methods. For each object, it's mandatory to create a header file (.h), implementation file (.cpp) and a driver. Blank files are included. The header should have the class definition in it. The implementation file should contain the implementations of the methods laid out in the header fine. And finally the Driver should test/demonstrate all the features of the class. It's best to develop the driver as the class is being written. Check each section to see if there are added additional requirements for the driver. Two test suites are included so that work can be checked.  It's important to implement the drivers to test and demonstrate Classes functionality. SongTest.cpp : 

#define CATCH_CONFIG_MAIN

#include "../Song.h"
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>


TEST_CASE("Should be able to create a Song") {
    Song *song = new Song("Bohemian Rhapsody", "Queen", 5, 54, "Rock", 1975);
}

TEST_CASE("Should be able to get the song title") {
    Song song2("Shape of You", "Ed Sheeran", 3, 54, "Pop", 2017);
    string title = song2.getTitle();
    REQUIRE_THAT("Shape of You", Catch::Matchers::Equals(title));
}

TEST_CASE("Should be able to get the song artist") {
    Song song3("Imagine", "John Lennon", 3, 3, "Rock", 1971);
    string title = song3.getArtist();
    REQUIRE_THAT("John Lennon", Catch::Matchers::Equals(title));
}

TEST_CASE("Should be able to get the song duration") {
    Song song3("Imagine", "John Lennon", 3, 3, "Rock", 1971);
    string duration = song3.getDuration();
    REQUIRE_THAT("3:03", Catch::Matchers::Equals(duration));
}

TEST_CASE("Should be able to get the song genre") {
    Song song3("Imagine", "John Lennon", 3, 3, "Rock", 1971);
    string genre = song3.getGenre();
    REQUIRE_THAT("Rock", Catch::Matchers::Equals(genre));
}

TEST_CASE("Should be able to get the song release year") {
    Song song3("Imagine", "John Lennon", 3, 3, "Rock", 1971);
    int releaseYear = song3.getReleaseYear();
    REQUIRE(1971 == releaseYear);
}

TEST_CASE("Should be able to get a string representation of the song") {
    Song *song = new Song("Bohemian Rhapsody", "Queen", 5, 54, "Rock", 1975);
    CHECK_THAT(song->toString(), Catch::Matchers::ContainsSubstring("Bohemian Rhapsody"));
    CHECK_THAT(song->toString(), Catch::Matchers::ContainsSubstring("Queen"));
}

TEST_CASE("Should be able to add a comment to a song") {
    Song *song = new Song("Bohemian Rhapsody", "Queen", 5, 54, "Rock", 1975);
    song->addComment("One of the greatest rock songs ever!");
}

TEST_CASE("Outputting the Song as a string should include song's comments") {
    Song *song = new Song("Bohemian Rhapsody", "Queen", 5, 54, "Rock", 1975);
    song->addComment("One of the greatest rock songs ever!");
    song->addComment("Amazing vocals!");
    CHECK_THAT(song->toString(), Catch::Matchers::ContainsSubstring("One of the greatest rock songs ever!"));
    CHECK_THAT(song->toString(), Catch::Matchers::ContainsSubstring("Amazing vocals!"));
} Song.cpp: #include "Song.h", Song.h: 

#include <string>
#include <vector>

using namespace std;

#ifndef SONG_H
#define SONG_H

 

#endif //SONG_H, 

SongDriver.cpp: 

#include <iostream>
using namespace std;

#include "Road.h"

int main() {
    std::cout << "Hello, Song Driver!" << std::endl;
    return 0;
}

Song Class
The song class will be used to simulate a song record. To make it a little more interesting we'll be able to store one or more comments with
each song.
Public Interface
• Song(title:string, artist:string, minutes:int, seconds:int, genre:string, release Year:int) Constructor that takes all the data methods
• getTitle():string returns the song title
getArtist():string returns the artist's name
• getDuration (): returns the song duration as a string formatted as M:SS. So a song that is 3 minutes and 5 seconds would be formatted
"3:05".
●
getGenre():string returns the song genre
• addComment(comment:string):void added a comment to the song
• toString():string returns a formatted string of the song. You may format it anyway you'd like, but it must include the song's title, artists and
all the comments. You can add other information if you'd like
Driver:
The driver should demonstrate all the features of the class. Additionally, you need to create an array of songs. Populate the array with 20 or so
songs from different genres. Then demonstrate a "filter" where you print out all the songs in the list that are in a specific genre.
mm
+SongCtitle: string, artist: string, minutes int, seconds int, genre: string, release Year: int) : void
+ get Title(): string
+ getArtist(): string
+ get Duration(): string
+ getGenre(): string
+ get Release Year(): int
+ toString(): string
+ addComment comment any): void
Example of a possible toString output:
Song
Wish You Where Here by Pink Floyd 5:38
Comments:
Great Song
"We're just two lost souls swimming in a fishbowl"
Year after year
Transcribed Image Text:Song Class The song class will be used to simulate a song record. To make it a little more interesting we'll be able to store one or more comments with each song. Public Interface • Song(title:string, artist:string, minutes:int, seconds:int, genre:string, release Year:int) Constructor that takes all the data methods • getTitle():string returns the song title getArtist():string returns the artist's name • getDuration (): returns the song duration as a string formatted as M:SS. So a song that is 3 minutes and 5 seconds would be formatted "3:05". ● getGenre():string returns the song genre • addComment(comment:string):void added a comment to the song • toString():string returns a formatted string of the song. You may format it anyway you'd like, but it must include the song's title, artists and all the comments. You can add other information if you'd like Driver: The driver should demonstrate all the features of the class. Additionally, you need to create an array of songs. Populate the array with 20 or so songs from different genres. Then demonstrate a "filter" where you print out all the songs in the list that are in a specific genre. mm +SongCtitle: string, artist: string, minutes int, seconds int, genre: string, release Year: int) : void + get Title(): string + getArtist(): string + get Duration(): string + getGenre(): string + get Release Year(): int + toString(): string + addComment comment any): void Example of a possible toString output: Song Wish You Where Here by Pink Floyd 5:38 Comments: Great Song "We're just two lost souls swimming in a fishbowl" Year after year
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT