As you see in pp. 638-640, structures are useful to store related data together that defined with different types. Here you are asked to modify the Payroll program that we have been working on previous labs. You are asked to write a program using structures and pointers as shown in the following, and store the in an output file. You may see "Appending a Node to the List" in pp. 1126-1128, and pp. 530-536. #include using namespace std; struct Employee_t { string Fname, Lname; int NofHours; float HourlyRate; char Major (Computer, Security); float Amount; Employee *next }; Employee *head; void print-record (struct *); //use setw() to align fields properly; Last Name ESU CPSC Your Name First Name Komp Scien Add 7 more of your own here... Create a file, Employee.txt. int main() { } # of Hours 30 40 40 for (int count=0; count < NumOfEmp; count++) {. print each line on your screen; //Allocate a new node and store. infile >> newNode->fname; infile >> newNode->NofHours; newNode-> = nullptr; print-record(newNode); *** Hourly Rate 40 30 35 return 0; Amount Comp Sci 2200 Y 2200 Y 3400 Y Comp Sec N N Y

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
the program below is the program that is being referred to in the image,
 
 
using namespace std;
struct varis
{
    string lastName, firstName;
    int hours, rate;
    double pay;
    int major_type[2];
};
void print_Title();
string readName();
int readHours();
int readPayRate();
int readMajor();
double computeAmount(int myMajor, double myPay);
void printRecord(varis info[], int size);

 

int main()
{
    print_Title();
    int size = 10;
    int x = 0;
    varis info[size];

 

    do
    {
        cout << "\nEnter first name, last name, numbers of hours worked, and hourly pay\n";
        info[x].firstName = readName();
        info[x].lastName = readName();
        info[x].hours = readHours();
        info[x].rate = readPayRate();
        info[x].pay = info[x].hours * info[x].rate;
        cout << "Type 1 if you are a Computer Science major or a 0 if you are not: ";
        info[x].major_type[0] = readMajor();
        cout << "Type 1 if you are a Cyber Security major or a 0 if you are not: ";
        info[x].major_type[1] = readMajor();
        info[x].pay = computeAmount(info[x].major_type[0], info[x].pay);
        info[x].pay = computeAmount(info[x].major_type[1], info[x].pay);
        ++x;
    } while (x < size);

 

    cout << endl;
    cout << left << setw(15) << "Last Name" << setw(15) << "First Name" << setw(15) << "# of Hours" << setw(15) << "Hourly Rate"
         << setw(15) << "Amount" << setw(15) << "Comp Sci" << setw(15) << "Comp Sec" << endl;
    printRecord(info, size);
    return 0;
}
 
string readName()
{
    string readName;
    cin >> readName;
    return readName;
}
int readHours()
{
    int readHours;
    cin >> readHours;
    return readHours;
}
int readPayRate()
{
    int readHours;
    cin >> readHours;
    return readHours;
}
int readMajor()
{
    int ReadMajor;
    cin >> ReadMajor;
    return ReadMajor;
}
double computeAmount(int myMajor, double myPay)
{
    switch (myMajor)
    {
    case 0:
        break;
    case 1:
        myPay += 1000.0;
        break;
    }
    return myPay;
}
void printRecord(varis info[], int size)
{
    int i = 0;
    do
    {
        cout << left << setw(15) << info[i].lastName << setw(15) << info[i].firstName << setw(15)
             << info[i].hours << setw(15) << info[i].rate << setw(15) << info[i].pay;

 

        if (info[i].major_type[0] == 0)
            cout << setw(15) << 'N';
        else
            cout << setw(15) << 'Y';
        if (info[i].major_type[1] == 0)
            cout << setw(15) << 'N';
        else
            cout << setw(15) << 'Y';
        cout << endl;

 

        ++i;
    } while (i < size);
};
 
 
As you see in pp. 638-640, structures are useful to store related data together that defined with different
types. Here you are asked to modify the Payroll program that we have been working on previous labs.
You are asked to write a program using structures and pointers as shown in the following, and store the
in an output file. You may see "Appending a Node to the List" in pp. 1126-1128, and pp. 530-536.
#include <bits/stdc++.h>
using namespace std;
struct Employee_t
{
string Fname, Lname;
int NofHours;
float HourlyRate;
char Major (Computer, Security);
float Amount;
Employee *next
};
Employee *head;
void print-record (struct *);
//use setw() to align fields properly;
Last Name
ESU
CPSC
Your Name
First Name
Komp
Scien
Add 7 more of your own here... Create a file, Employee.txt.
int main()
{
}
# of Hours
30
40
40
for (int count=0; count < NumOfEmp; count++)
{.
print each line on your screen;
//Allocate a new node and store.
infile >> newNode->fname;
infile >> newNode->NofHours;
newNode-> = nullptr;
print-record(newNode);
***
Hourly Rate
40
30
35
return 0;
Amount Comp Sci
2200
Y
2200
Y
3400
Y
Comp Sec
N
N
Y
Transcribed Image Text:As you see in pp. 638-640, structures are useful to store related data together that defined with different types. Here you are asked to modify the Payroll program that we have been working on previous labs. You are asked to write a program using structures and pointers as shown in the following, and store the in an output file. You may see "Appending a Node to the List" in pp. 1126-1128, and pp. 530-536. #include <bits/stdc++.h> using namespace std; struct Employee_t { string Fname, Lname; int NofHours; float HourlyRate; char Major (Computer, Security); float Amount; Employee *next }; Employee *head; void print-record (struct *); //use setw() to align fields properly; Last Name ESU CPSC Your Name First Name Komp Scien Add 7 more of your own here... Create a file, Employee.txt. int main() { } # of Hours 30 40 40 for (int count=0; count < NumOfEmp; count++) {. print each line on your screen; //Allocate a new node and store. infile >> newNode->fname; infile >> newNode->NofHours; newNode-> = nullptr; print-record(newNode); *** Hourly Rate 40 30 35 return 0; Amount Comp Sci 2200 Y 2200 Y 3400 Y Comp Sec N N Y
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

can you implement it where if the major is comp sci or cyber sec it adds 1000 to their amount and if its both then it adds 2000 to their amount. 

 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Linked List Representation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education