Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I wrote this program of speaker bureau. This program was made using structures,

ID: 3544502 • Letter: I

Question

I wrote this program of speaker bureau. This program was made using structures, but now I have to make the program using only classes no structures. Could someone help me with this exercise. I don't know much about classes.




/*9. Speakers' Bureau


Write a program that keeps track of a speakers' bureau. The program should use a


stmctu re to store the follow ing data about a speaker:


Name


Telephone Number


Speaking Topic


Fee Required


The program should use an array of at least 10 structures. It should let the user enter


data into the array, change the contents of any element, and display all the data stored


in the array. The program should have a menu-driven user interface.


Input Validation: When the data for a new speaker is entered, be sure the IIser enters


data for all the fields. No negative amounts should be entered for a speaker's fee.


/*


#include<iostream>


#include<string>


#include<iomanip>


using namespace::std;




struct SpeakersBureau{



string Name;


int TelNo;


string sTopic;


float fee;


};//Declaracion de estructura.




void Display(SpeakersBureau speakers[], int );




int main(){




SpeakersBureau speakers[10];


int choice, i=0, size=0;


do{


cout << "****************************************" << endl;


cout << " Menu " << endl;


cout << "****************************************" << endl;


cout << " 1.Escribir Data en el arreglo." << endl;


cout << " 2.Modificar Data." << endl;


cout << " 3.Display Data." << endl;


cout << " 4.Salir." << endl;


cout << "**************************************** " << endl;


cout << "Entre opcion: ";


cin >> choice;



switch(choice){


case 1:


cout << "Escriba el numero de Speakers: " ;


cin >> size;


for(i=0; i<size; i++){


cout << "Entre el Nombre del Speaker #" << (i+1) << ": ";


cin >> speakers[i].Name;


cout << "Entre el Numero de Telefono del Speaker #" << (i+1) << ": ";


cin >> speakers[i].TelNo;


cout << "Entre el Tema del Speaker #" << (i+1) << ": ";


cin >> speakers[i].sTopic;


cout << "Entre la Tarifa Requerida: $";


cin >> speakers[i].fee;



if(speakers[i].fee < 0){


cout << "Error. La Tarifa no puede ser un valor negativo, intente otra vez: $" << endl;


cin >> speakers[i].fee;


i++;


}


}//end for.



break;


case 2:


int ele;


cout << "Entre el elemento que va a modificar: ";


cin >> ele;



cout << "Entre el nombre: ";


cin >> speakers[ele-1].Name;


cout << "Entre el Numero de Telefono: ";


cin >> speakers[ele-1].TelNo;


cout << "Entre el Tema: ";


cin >> speakers[ele-1].sTopic;


cin >> speakers[ele-1].fee;




break;


case 3:


Display(speakers, size);


break;


case 4:


cout << "Salir. ";


break;


}//end Switch.


}while(choice!=4);//end do-while.


return 0;


}//end main.




void Display(SpeakersBureau speakers[], int size){


for(int i=0; i<size; i++){


cout << "****************************************" << endl;


cout << " Nombre del Speaker #" << (i+1) << ": " << speakers[i].Name << endl;


cout << "Numero de Telefono del Speaker #" << (i+1) << ": " << speakers[i].TelNo << endl;


cout << "Tema del Speaker #" << (i+1) << ": " << speakers[i].sTopic << endl;


cout << "Tarifa Requerida: $" << speakers[i].fee << endl;


cout << " ****************************************" << endl;


}//end for.


}//end Display.

Explanation / Answer

#include<iostream>

#include<string>

#include<iomanip>

using namespace std;

class SpeakersBureau{

public:

string Name;

int TelNo;

string sTopic;

float fee;

public:

void Display(SpeakersBureau speakers[], int size)

{

for(int i=0; i<size; i++){

cout << "****************************************" << endl;

cout << " Nombre del Speaker #" << (i+1) << ": " << speakers[i].Name << endl;

cout << "Numero de Telefono del Speaker #" << (i+1) << ": " << speakers[i].TelNo << endl;

cout << "Tema del Speaker #" << (i+1) << ": " << speakers[i].sTopic << endl;

cout << "Tarifa Requerida: $" << speakers[i].fee << endl;

cout << " ****************************************" << endl;

}

}

};

int main(){

SpeakersBureau speakers[10],a;

int choice, i=0, size=0;

do{

cout << "****************************************" << endl;

cout << " Menu " << endl;

cout << "****************************************" << endl;

cout << " 1.Escribir Data en el arreglo." << endl;

cout << " 2.Modificar Data." << endl;

cout << " 3.Display Data." << endl;

cout << " 4.Salir." << endl;

cout << "**************************************** " << endl;

cout << "Entre opcion: ";

cin >> choice;

switch(choice){

case 1:

cout << "Escriba el numero de Speakers: " ;

cin >> size;

for(i=0; i<size; i++){

cout << "Entre el Nombre del Speaker #" << (i+1) << ": ";

cin >> speakers[i].Name;

cout << "Entre el Numero de Telefono del Speaker #" << (i+1) << ": ";

cin >> speakers[i].TelNo;

cout << "Entre el Tema del Speaker #" << (i+1) << ": ";

cin >> speakers[i].sTopic;

cout << "Entre la Tarifa Requerida: $";

cin >> speakers[i].fee;

if(speakers[i].fee < 0){

cout << "Error. La Tarifa no puede ser un valor negativo, intente otra vez: $" << endl;

cin >> speakers[i].fee;

i++;

}

}

break;

case 2:

int ele;

cout << "Entre el elemento que va a modificar: ";

cin >> ele;

cout << "Entre el nombre: ";

cin >> speakers[ele-1].Name;

cout << "Entre el Numero de Telefono: ";

cin >> speakers[ele-1].TelNo;

cout << "Entre el Tema: ";

cin >> speakers[ele-1].sTopic;

cin >> speakers[ele-1].fee;

break;

case 3:

a.Display(speakers, size);

break;

case 4:

cout << "Salir. ";

break;

}

}while(choice!=4);

return 0;

}