Question

c++ C++ CLASSES and objects DO ADD COMMENTS DISPLAY OUTPUT First make three files: episode.cpp, episode.h...

c++

C++ CLASSES and objects
DO ADD COMMENTS
DISPLAY OUTPUT
First make three files: episode.cpp, episode.h andRun.cpp to separate class header and implementation.

In this program, we are going to create a small scale Telivision Management System.

A)
Create a class Episode with following variables:
char* episode_name, char* episode_venue, char episode_date[22] and char episode_time[18].
Input format for episode_date: dd-mm-yyyy
Input format for episode_time: hh:mm am/pm

B)
Implement default constructor and overloaded constructor. Print “Default Constructor Called” and “Overloaded Constructor Called” in the respective constructors. The declaration for overloaded constructor is as follows:
Episode(char episode_name[200], char episode_venue[100], char episode_date[22],char episode_time[18]);

C)
Implement all setters and getters for class Episode. You can create a helper function userInput() to input episode details.

D)
Implement the destructor ~Episode() for class Episode. Print “Destructor Called” in the destructor. Deallocate all the dynamically allocated memory of class data members.

E)
Maintain an array of four Episode objects in theRun.cpp. i.e.
Episode* episode = new Episode[4];

F)
Implement addEpisodeOver() function. This function will add a new Episode object to the episode object array using overloaded constructor.

G)
Implement addEpisodeSet() function. This function will add a new Episode object to the episode object array using setters.

H)
Implement displayEpisodes() function. This will display all episode currently present in the episode object array. You can use getters in this function.

I)
Implement a menu program inRun.cpp.

example Menu Program:

Menu Program
Add New Episode Using Overloaded Constructor: Enter 1
Add New Episode Using Setters: Enter 2
Display All Episodes: Enter 3
Exit: Enter 0

Enter your choice: 1

Add New Episode
Enter episode name: NATIONAL GEOGRAPHICS
Enter episode venue: HBO
Enter episode date: 17-12-2022
Enter episode time: 9:30 PM

N.B:
Deallocate all dynamically allocated memory.
Do not use copy constructor.
Do not use strcpy() function. Copy the character array manually where needed based on ending ‘\0’ character.
Follow all the code indentation, naming conventions and code commenting guidelines.

fullfill all the requirement of program by implementing all the parts

Homework Answers

Answer #1

This is all the function details

/*----------------------------
File Name: episode.h
----------------------------*/
//class declaration
#include <string>
class episode
{
private :
char  episode_name[200];
char  episode_venue[100];
char  episode_date[22];
char  episode_time[18];
public:
episode();
episode(char episode_name1[200], char episode_venue1[100], char episode_date1[22],char episode_time1[18]);
void set_method(char episode_name1[200], char episode_venue1[100], char episode_date1[22],char episode_time1[18]);
void display();
std::string get_episode_name();
std::string get_episode_venue();
std::string get_episode_date(); 
std::string get_episode_time(); 
~episode();
};

file 2

/*--------------------------
File Name:- episode.cpp
---------------------------*/
//imported library
#include<string>
#include<cstdio>
#include<bits/stdc++.h>
#include"episode.h"
//default constructor
episode::  episode()
{
  this->episode_name[0]='\0';
  this->episode_venue[0]='\0';
  this->episode_date[0]='\0';
  this->episode_time[0]='\0';
}
//parametrized constructor
episode :: episode(char episode_name1[200], char episode_venue1[100], char episode_date1[22],char episode_time1[18])
{
   strncpy(episode_name,episode_name1,200);
  strncpy(episode_venue,episode_venue1,100);
  strncpy(episode_date,episode_date1,22);
  strncpy(episode_time,episode_time1,18);
}
//set methods to invoked details
void episode :: set_method(char episode_name1[200], char episode_venue1[100], char episode_date1[22],char episode_time1[18])
{
  strncpy(episode_name,episode_name1,200);
  strncpy(episode_venue,episode_venue1,100);
  strncpy(episode_date,episode_date1,22);
  strncpy(episode_time,episode_time1,18);
}
//function to return private value
std::string episode:: get_episode_name() {return episode_name;}
std::string episode::get_episode_venue() {return episode_venue;}
std::string episode::get_episode_date() {return episode_date;}
std::string episode::get_episode_time() {return episode_time;}
//destructor
episode::  ~episode()
{
}

file number 3

/*-------------------------------
FILE NAME : Run.cpp
--------------------------------*/
//imported library 
#include<bits/stdc++.h>
#include"episode.h"
using namespace std;
//main function start
int main()
{
string  str1,str2,str3,str4;
char name[200],venue[100],date[22],time[18];
episode epi[4];//("National Geographics","HB0","17-12-2022","9:30 PM");
for(int i=0;i<4;i++)
{
 cout<<"Enter details number :  "<<i+1<<endl;
 cout<<"Enter episode name : "<<endl;
 getline(cin,str1);
 cout<<"Enter venue name : "<<endl;
 getline(cin,str2);
 cout<<"Enter date : "<<endl;
 getline(cin,str3);
 cout<<" Enter time : "<<endl;
 getline(cin,str4);
 strcpy(name, str1.c_str()); 
 strcpy(venue, str2.c_str()); 
 strcpy(date, str3.c_str()); 
 strcpy(time, str4.c_str()); 
 epi[i].set_method(name,venue,date,time);
 }
cout<<"---------------------------------"<<endl;
cout<<"EPISODE DETAILS :: "<<endl;
cout<<"---------------------------------"<<endl;
for(int i=0;i<4;i++)
{
cout<<"\nDetail number :: " <<i+1<<endl;
cout<<"------------------------------"<<endl;
cout<<"episode name : "<<epi[i].get_episode_name()<<endl;
cout<<"Venue name : "<<epi[i].get_episode_venue()<<endl;
cout<<"Date  details : "<<epi[i].get_episode_date()<<endl;
cout<<"time  details : "<<epi[i].get_episode_time()<<endl;
}
return 0;
}

if you have g++ terminal

then for run type g++ Run.cpp episode.cpp for compilation

and run ./a.out

then enter your necessary details

then return method invoked will return your details

//output

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF A RUNNING COMPILER QUESTION: 1) Fibonacci sequence is a sequence in which every number after the first two is the sum of the two preceding ones. Write a C++ program that takes a number n from user and populate an array with first n Fibonacci numbers. For example: For n=10 Fibonacci Numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 2): Write...
write a c++ program A class called car (as shown in the class diagram) contains: o...
write a c++ program A class called car (as shown in the class diagram) contains: o Four private variables: carId (int), carType (String), carSpeed (int) and numOfCars (int). numOfCars is a static counter that should be  Incremented whenever a new Car object is created.  Decremented whenever a Car object is destructed. o Two constructors (parametrized and copy constructor) and one destructor. o Getters and setters for the Car type, ID, and speed. And static getter function for numOfCars....
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
Write in C++. Define a class called Text whose objects store lists of words. The class...
Write in C++. Define a class called Text whose objects store lists of words. The class Text will be just like the class StringVar except that the class Text will use a dy- namic array with base type StringVar rather than base type char and will mark the end of the array with a StringVar object consisting of a single blank, rather than using '\0' as the end marker. Intuitively, an object of the class Text represents some text consisting...
In c++ create a class to maintain a GradeBook. The class should allow information on up...
In c++ create a class to maintain a GradeBook. The class should allow information on up to 3 students to be stored. The information for each student should be encapsulated in a Student class and should include the student's last name and up to 5 grades for the student. Note that less than 5 grades may sometimes be stored. Your GradeBook class should at least support operations to add a student record to the end of the book (i.e., the...
Create a C# application You are to create a class object called “Employee” which included eight...
Create a C# application You are to create a class object called “Employee” which included eight private variables: firstN lastN dNum wage: holds how much the person makes per hour weekHrsWkd: holds how many total hours the person worked each week. regHrsAmt: initialize to a fixed amount of 40 using constructor. regPay otPay After going over the regular hours, the employee gets 1.5x the wage for each additional hour worked. Methods:  constructor  properties  CalcPay(): Calculate the regular...
You are asked to implement a C++ class to model a sorted array of unsigned integers....
You are asked to implement a C++ class to model a sorted array of unsigned integers. The class is to be used in an embedded application that cannot assume the presence of the STL. The array has to be dynamically allocated in such a way that allows programmers using it to specify the required size. Your class should should: (1) provide the appropriate constructors and destructor; (2) provide methods for updating, and showing numbers in/to the array (e.g., to be...
(In c code only, not c++) We will simulate the status of 8 LEDs that are...
(In c code only, not c++) We will simulate the status of 8 LEDs that are connected to a microcontroller. Assume that the state of each LED (ON or OFF) is determined by each of the bits (1 or 0) in an 8-bit register (high-speed memory). Declare a char variable called led_reg and initialize it to 0. Assume that the least-significant bit (lsb) controls LED#0 and the most-significant bit (msb) controls LED#7. In the main function, build and present a...
Lab Objectives This lab was designed to inforce the following programming concepts: • Using classes to...
Lab Objectives This lab was designed to inforce the following programming concepts: • Using classes to create a data type SimpleCalculator capable of performing arithmetic operations. • Creating const member functions to enforce the principle of least privilege. The follow-up questions and activities also will give you practice: • Using constructors to specify initial values for data members of a programmer-defined class. Description of the Problem Write a SimpleCalculator class that has public methods for adding, subtracting, multiplying and dividing...
Create a simple Java class for a Month object with the following requirements:  This program...
Create a simple Java class for a Month object with the following requirements:  This program will have a header block comment with your name, the course and section, as well as a brief description of what the class does.  All methods will have comments concerning their purpose, their inputs, and their outputs  One integer property: monthNumber (protected to only allow values 1-12). This is a numeric representation of the month (e.g. 1 represents January, 2 represents February,...