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,...
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...
(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...
Goal:   Manage the inventory of objects sold in an online or brick and mortar store. If...
Goal:   Manage the inventory of objects sold in an online or brick and mortar store. If you can't implement all of the features of Project described in this document, implement what you can. Start by implementing the StockItem class, and its derived classes. Then add in the InventoryManager class later. In each case, the test files must be in separate classes. UML Diagram: Use Violet or other drawing software to draw the UML diagrams of each class that you use...
Complete this in C++ and explain what is being done. 1      Introduction The functions in the...
Complete this in C++ and explain what is being done. 1      Introduction The functions in the following subsections can all go in one big file called pointerpractice.cpp. 1.1     Basics Write a function, int square 1(int∗ p), that takes a pointer to an int and returns the square of the int that it points to. Write a function, void square 2(int∗ p), that takes a pointer to an int and replaces that int (the one pointed to by p) with its...
MUST WRITE IN C++ Objective: Learn how to design classes using abstract classes and inheritance Assignment:...
MUST WRITE IN C++ Objective: Learn how to design classes using abstract classes and inheritance Assignment: MUST WRITE IN C++ Objective: Learn how to design classes using abstract classes and inheritance Assignment: In cryptography, encryption is the process of encoding a message or information in such a way that only authorized parties can access it. In this lab you will write a program to decode a message that has been encrypted using two different encryption algorithms. Detailed specifications: Define an...
Cpp Task: Create a class called Mixed. Objects of type Mixed will store and manage rational...
Cpp Task: Create a class called Mixed. Objects of type Mixed will store and manage rational numbers in a mixed number format (integer part and a fraction part). Details and Requirements Your class must allow for storage of rational numbers in a mixed number format. Remember that a mixed number consists of an integer part and a fraction part (like 3 1/2 – “three and one-half”). The Mixed class must allow for both positive and negative mixed number values. A...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT