Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to create a program that allows the user to enter data for multiple employees within two different departments. The data entered: employee ID,

I need to create a program that allows the user to enter data for multiple employees within two different departments.

The data entered: employee ID, # of traffic tickets, # of accidents, employee department

I need to make the function allow two sets of data to be entered per department (Technology department and Business Department)

I need to make a function that displays the percentage of employees with traffic tickets and the percentage of employees with accidents for each department.

I need to make a function that displays the lowest percentage for traffic tickets and the lowest percentage of accidents, which will display the which department won for each.

I need one function that allows data input for both departments instead of having a separate function for each. I also need a function that displays the percentages for both departments instead of having a separate function for each. (local variables and global constants, local variables with the same name, etc.)

// This program calculates the lowest percentage for traffic tickets and accidents

#include #include

using namespace std;

// Function prototypes void welcome(); void gatherInputTech(long int, int, int, char); void gatherInputBus(long int, int, int, char); void deptReportTech(); void deptReportTechBus(); void displayWinner(): void goodbye();

// Main Function that holds the call functions int main() {

// Calling the function that displays the welcome message welcome();

// Calling the function that asks for the Technology department info gatherInputTech(employeeID, TechTrafficTickets, TechAccidents, deptID);

// Calling the function that asks for the Business department info gatherInputBus(employeeID, BusTrafficTickets, BusAccidents, deptID);

// Calling the function that displays the data input for the Technology department deptReportTech();

// Calling the function that displays the data input for the Business department deptReportBus();

// Calling the function that displays the lowest percentage for traffic tickets and traffic accidents (The Winner) displayWinner();

// Calling the function to display the goodbye message goodbye();

return 0;

}

// Function definition to display a welcome message and explain what the program does void welcome() { cout << "Welcome to the safe driving program for the UTA Tuna Corporation." << endl; cout << "" << endl; cout << "This program will calculate last year's percentages of employee traffic "; cout << "tickets and accidents for each department." << endl; cout << "" << endl; cout << "The department with the best drivers will earn a bonus!" << endl; }

// Function definition to gather data input for the Technology department void gatherInputTech (long int employeeID, int TechTrafficTickets, int TechAccidents, char deptID) { int TechEmployees; int num; long int employeeID; int TechTrafficTickets; int TechAccidents; char deptID;

cout << "How many employees are you entering info in for the Technology department?" << endl; cin >> TechEmployees;

while (num < TechEmployees) { cout << "please enter the Employee ID." << endl; cin >> employeeID; cout << "" << endl; cout << "Please enter the number of traffic tickets the employee received last year." << endl; cin >> TechTrafficTickets; cout << "" << endl; cout << "Please enter the number of traffic accidents the employee had last year." << endl; cin >> TechAccidents; cout << "" << endl; cout << "Please enter the employee's Department ID ("T" for Technology and "B" for Business)." << endl; cin >> deptID; cout << "" << endl; num++; } }

// Function definition to gather input data for the Business department void gatherInputBus (long int employeeID, int BusTrafficTickets, int BusAccidents, char deptID) { int BusEmployees; int num; long int employeeID; int BusTrafficTickets; int BusAccidents; char deptID;

cout << "How many employees are you entering info for the Business department?" << endl; cin >> BusEmployees;

while (num < BusEmployees) { cout << "please enter the Employee ID." << endl; cin >> employeeID; cout << "" << endl; cout << "Please enter the number of traffic tickets the employee received last year." << endl; cin >> BusTrafficTickets; cout << "" << endl; cout << "Please enter the number of traffic accidents the employee had last year." << endl; cin >> BusAccidents; cout << "" << endl; cout << "Please enter the employee's Department ID ("T" for Technology and "B" for Business)." << endl; cin >> deptID; cout << "" << endl; num++; } }

// Function definition to display the report data for the Technology department void deptReportTech() { double TechTicketPercentage; double TechAccidentPercentage;

TechEmployees / TechTrafficTickets = TechTicketPercentage; TechEmployees / TechAccidents = TechAccidentPercentage;

cout << "The Technology Department has a total of " << TechEmployees << endl; cout << TechTicketPercentage << "% of employees received traffic tickets last year." << endl; cout << TechAccidentPercentage << "% of employees were in a traffic accident last year." << endl; }

// Function definition to display the report data for the Business department void deptReportBus() { double BusTicketPercentage; double BusAccidentPercentage;

BusEmployees / BusTrafficTickets = BusTicketPercentage; BusEmployees / BusAccidents = BusAccidentPercentage;

cout << "The Business Department has a total of " << BusEmployees << endl; cout << BusTicketPercentage << "% of employees received traffic tickets last year." << endl; cout << BusAccidentPercentage << "% of employees were in a traffic accident last year." << endl; }

// Function definition to display the lowest percentages or traffic tickets and accidents void displayWinner() { if (TechTicketPercentage < BusTicketPercentage) { cout << "The lowest percentage of traffic tickets is " << TechTicketPercentage << endl; } else { cout << "The lowest percentage of traffic tickets is " << BusTicketPercentage << endl; }

if (TechAccidentPercentage < BusTicketPercentage) { cout << "The lowest percentage of traffic accidents is " << TechAccidentPercenatge << endl; } else { cout << "The lowest percentage of traffic accidents is " << BusAccidentPercentage << endl; } }

// Function definition to display a message that says goodbye and displays contact information void goodbye() { cout << "" << endl; cout << "Thank you for purchasing the safe driver software!" << endl; cout << "Please feel free to contact us if you have any questions" << endl; cout << "safedrivercontact@email.com or 123-456-789" << endl; cout << "" << endl; cout << "Goodbye!" << endl; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

identify current issues relating to equal pay in organisations

Answered: 1 week ago