In: Computer Science
Write a C++ program that design a class
definition to be put in
a header file called fizzjazz.h A store sells online FizzJazz
which are sound tones made by famous bands. For each
FizzJazz,
the store wants to keep track of the following attributes:
* title - the name of the sound tone
* band - Famous band name that created the tone
* duration - this is in seconds and may be fractional:
examples: 20.0, 34.5
Each attribute will have a corresponding getter(accessor)
function or setter(mutator) function. PLEASE PUT ONLY
FUNCTION PROTOTYPES IN YOUR CLASS; DO NOT ADD ANY FUNCTION
IMPLEMENTATION CODE. These would normally be put into
a.cpp
file which you do not need to provide.
Also remember to add a default constructor as well as a
constructor
that takes the attributes.
Program Code [C++]
fizzjazz.h
// Header Guards
#ifndef FIZZ_JAZZ_H
#define FIZZ_JAZZ_H
#include <iostream>
using namespace std;
// FizzJazz class
class FizzJazz {
private:
// All Required attributes
string title;
string band;
double duration;
public:
// All Required functions
prototypes
// Default Constructor
FizzJazz();
// Parameterized constructor
FizzJazz(string, string,
double);
// Setters & Getters for all
attributes
void setTitle(string);
void setBand(string);
void setDuration(double);
string getTitle();
string getBand();
double getDuration();
};
#endif
----------------------------------------------------------------------
COMMENT DOWN FOR ANY QUERIES!!!
HIT A THUMBS UP IF YOU DO LIKE IT!!!