<p>At this particular time, I am taking comp science part 2. I am currently stru
ID: 3638219 • Letter: #
Question
<p>At this particular time, I am taking comp science part 2. I am currently struggling piecing together the final stages of the prorgam listed below. It is asking me the "user" to show any and all employees, but<span><strong> not </strong></span>those that have the default id of -1(negative one). I am looking for assistance on how to adjust the compiled information to make it work without any errors once outputted. Any help is greatly needed and welcomed...</p><p>#include<iostream><br />using namespace std;</p>
<p>class employee<br />{<br />private:</p>
<p>int id, maxHours;<br />float payRate;</p>
<p>public:</p>
<p>void setInfo (int pin, float pay, int hours)<br />{<br />id = pin;<br />payRate = pay;<br />maxHours = hours;<br />}</p>
<p>void viewInfo ()<br />// No parameters req.<br />{<br />cout<<"employee id: "<<id<<endl;<br />cout <<"employee pay rate: "<< payRate<<endl;<br />cout <<"employee max working hours"<<maxHours<<endl;</p>
<p>}</p>
<p>};</p>
<p>int main ( )<br />{</p>
<p>int pin, hours, record;<br />float pay;<br />int ch;<br />char ans;<br />employee empInfo[1000];<br />cout<<"1.ADD EMP 2.MODIFY EMP 3.DELETE EMP 4.EXIT";<br />cout<<"enter the choice: ";<br />cin>>ch;</p>
<p>switch(ch)<br />{</p>
<p>case 1:<br />cout <<"Enter employee 3 digit ID: ";<br />cin >> pin;<br />cout <<"Enter employee pay rate: ";<br />cin >> pay;<br />cout <<"Enter employee max hours: ";<br />cin >> hours;<br />empInfo[pin].setInfo(pin, pay, hours);<br />break;</p>
<p>case 2:<br />cout <<"Enter the employee ID# of the record you wish to modify ";<br />cin >> record;<br />empInfo[record].viewInfo();<br />break;</p>
<p>case 3:<br />cout <<"Enter the employee ID# of the record you wish to modify ";<br />cin >> record;<br />empInfo[pin].setInfo(0,0,0);<br />break;</p>
<p>case 4:<br />break;<br />}</p>
<p>return 0;</p>
<p>}</p>
Explanation / Answer
#include using namespace std; class employee { private: int id, maxHours; float payRate; public: void setInfo (int pin, float pay, int hours) { id = pin; payRate = pay; maxHours = hours; } void viewInfo () // No parameters req. { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.