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.
Song.h :
#include <vector>
using namespace std;
#ifndef SONG_H
#define SONG_H
#endif //SONG_H
#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!"));
}
using namespace std;
#include "Road.h"
int main() {
std::cout << "Hello, Song Driver!" << std::endl;
return 0;
}
Step by stepSolved in 3 steps
- 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…arrow_forwardIn this exercise, you are going to build on your Circleclass from the previous exercise. You are going to add 2 method, areaDifference and perimeterDifference. Both methods take a doubleradius of a second circle and return the difference from the current circle. For example, if you create a Circle object with a radius of 4 and call areaDifference(3), you will return the diffence between the area of a circle with radius 4 and the area of a circle with a radius of 3. perimeterDifferencewould be the same. Make sure you create at least one Circle and test and print the results of your methods. in javaarrow_forwardsolve this question using java You must define a class named MediaRental that implements the MediaRentalInt interface functionality(index A). You must define classes that support the functionality specified by the interface:. Define a class named MediaRental. Feel free to add any instance variables you understand are needed or any private methods. Do not add any public methods (beyond the ones specified in the MediaRentalInt interface).. The media rental system keeps track of customers and media (movies ,music albums and games). A customerhas a name, address as string , a plan and two lists. One list represent the media the customer is interested inreceiving and the second one represents the media already received (rented) by the customer. There are twoplans a customer can have: UNLIMITED and LIMITED. UNLIMITED allows a customer to receive as many mediaas they want; LIMITED restricts the media to a default value of 2 (this value can be change via a media rentalclass method).A movie has…arrow_forward
- In this exercise, we are going to model some behaviors of a square. Since the Square object extends the Rectangle object, we see that a lot of the information we need is stored in the superclass and we will need to access it using the super keyword. Your job is to complete the Square class, as specified within the class. Upon completion, thoroughly test out your code using the SquareTester class. ----------------------------------- public class SquareTester{public static void main(String[] args){// Start here!}} ----------------------------------- public class Rectangle { private double width;private double height; public Rectangle(double w, double h){width = w;height = h;} public double getWidth(){return width;} public void setWidth(double w){width = w;} public double getHeight(){return height;} public void setHeight(double h){height = h;} public String toString(){return "Rectangle with width " + width + " and height " + height;}} ----------------------------------- public class…arrow_forwardCreate a new project called Family. Add a person class with name, birthDate, and sex private instance variables. Create the public getter and setter methods for each. Create an overloaded constructor that initializes all of the instance variables. Create the default constructor. Override the toString () method to show the Person's info. Create the Person in the main method, and display that person's info. Now add a new instance variable to the Person class of type Person with the identifier spouse. Spouse should be private with setter and getter methods. If you try to instantiate spouse in the contructor, you will get a stack overflow error. Each Person, creates a Person, creates a Person, and so on forever. Try that to see the error and then remove the code from the constructor. Add the following logic: in Person there should be a method to show Spouse. If spouse is null, display or return "Not Married", otherwise call the toString() method. The should also be a get married method.…arrow_forwardplease may you : create a Python class named Animal with properties for name, age, and a method called speak. also include an initializer method for the class and demonstrate how to create an instance of this class. and extend the Animal class by adding a decorator for one of its properties (e.g., age). please include both a getter and a setter for the property, and demonstrate error handling.arrow_forward
- In JavaScript, how are an object and an interface related to each other? a. The object’s interface consists of the code and data needed for that object. b. An object’s interface is analogous to a pocket calculator’s inner workings. c. Built-in JavaScript objects do not require an interface, but custom objects do. d. An interface allows another program to access an object’s properties and methods.arrow_forwardCreate a Class Student in which we have three instance variables emp_name, emp_id, and Salary. Write getter and setters for each instance variable. Write another Display method that displays the record of Employee. In Main create five Employee’s Objects. Set their values as required and display as well. In the end Display top three employees with respect to Salary (Display those who have more Salary among all).arrow_forwardDraw the UML diagram for the class. Implement the class. Write a test program that creates an Account object with an account ID of 1122, a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500, use the deposit method to deposit $3,000, and print the balance, the monthly interest, and the date when this account was created.arrow_forward
- For this lab task, you will work with classes and objects. Create a class named text that works similar to the built-in string class. You will need to define a constructor that can be used to initialize objects of this new class with some literal text. Next, define three methods: to_upper() that will convert all characters to uppercase, reverse() that will reverse the text and length() that will return the length of the text. After you have completed this part, copy the following mainfunction to your code and check if the implementation is correct. int main() { text sample = "This is a sample text"; cout << sample.to_upper(); // This should display "THIS IS A SAMPLE TEXT" cout << endl;cout << sample.reverse(); // This should display "txet elpmas a si sihT"cout << endl; cout << sample.length(); // This should display 21 }arrow_forwardCan you help me with this please: Write the definition of a class swimmingPool, to implement the properties of a swimming pool. Your class should have the instance variables to store the length (in feet), width (in feet), depth (in feet), the rate (in gallons per minute) at which the water is filling the pool, and the rate (in gallons per minute) at which the water is draining from the pool. Add appropriate constructors to initialize the instance variables. Also, add member functions to do the following: determine the amount of water needed to fill an empty or partially filled pool, determine the time needed to completely or partially fill or empty the pool, and add or drain water for a specific amount of time, if the water in the pool exceeds the total capacity of the pool, output "Pool overflow" to indicate that the water has breached capacity. The header file for the swimmingPool class has been provided for reference. Write a program to test your swimmingPool class. An example of…arrow_forwardBelow 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…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education