Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a computer science project in the C + + language and I have code, but I also want to complete it with these

I have a computer science project in the C++ language and I have code, but I also want to complete it with these requirements. I ask you, if there is an error in my code, correct it for me and send me the complete correct code so that I can run it. I will send you the code now and I want you to complete it with these requirements.
this is the code
#include
#include
using namespace std;
struct accounts {
string name;
int phoneNumber;
string nuberhode;
int payments;
};
void inputData(accounts print[], int size);
void bubbleSort(accounts print[], int size);
void outputData(accounts print2[], int size);
int calculatePaymentSum(accounts print[], int size);
double calculateSalarySum(struct driver* drivers, int num);
struct driver {
string name;
double salary;
void fineDeduction(){
double fine =0.10* salary;
salary -= fine;
}
};
int main(){
int size;
cout << "Enter number of students: ";
cin >> size;
accounts a[size];
inputData(a, size);
bubbleSort(a, size);
outputData(a, size);
int paymentSum = calculatePaymentSum(a, size);
cout << "Total payment sum: "<< paymentSum << endl;
int num;
cout << "Please enter the number of drivers: ";
cin >> num;
driver *dd = new driver[num];
for (int i =0; i < num; i++){
cout << "Please enter the driver's name: ";
cin >> dd[i].name;
cout << "Please enter the driver's salary: ";
cin >> dd[i].salary;
}
char vio;
cout <<"Is there any violation against the driver? Y/N: ";
cin >> vio;
if (vio =='Y'|| vio =='y'){
cout << "Enter the name of the driver who violated: ";
string violatorName;
cin >> violatorName;
bool found = false;
for (int i =0; i < num; i++){
if (dd[i].name == violatorName){
dd[i].fineDeduction();
found = true;
break;
}
}
if (!found){
cout << "Driver not found!" << endl;
}
for (int i =0; i < num; i++){
cout << "Driver's name: "<< dd[i].name << endl;
cout << "Driver's salary: "<< dd[i].salary << endl;
}
}
double salarySum = calculateSalarySum(dd, num);
cout << "Total salary sum: "<< salarySum << endl;
delete[] dd;
double TheCost;
char BusMaintenance;
cout<<" Does the bus need maintenance Y / N ?";
cin>>BusMaintenance;
if (BusMaintenance =='Y'|| BusMaintenance =='y'){
cout<<" how much does it cost?";
cin>>TheCost;
cout<< "The profit earned by the bus : "<> print[i].name;
cout << "Enter phoneNumber of student: ";
cin >> print[i].phoneNumber;
cout << "Enter neighbourhood of student: ";
cin >> print[i].nuberhode;
cout << "Enter payments the student pays this month: ";
cin >> print[i].payments;
if (print[i].payments >0){
count++;
}
}
size = count;
}
void bubbleSort(accounts print[], int size){
for (int i =0; i < size -1; i++){
for (int j =0; j < size - i -1; j++){
if (print[j].payments < print[j +1].payments){
accounts temp = print[j];
print[j]= print[j +1];
print[j +1]= temp;
}
}
}
}
void outputData(accounts print2[], int size){
for (int i =0; i < size; i++){
cout << "Name of the student: "<< print2[i].name << endl;
cout << "phoneNumber of the student: "<< print2[i].phoneNumber << endl;
cout << "Neighbourhood of the student: "<< print2[i].nuberhode << endl;
cout << "Payments the student pays this month: ";
cout << print2[i].payments << endl;
}
}
int calculatePaymentSum(accounts print[], int size){
int sum =0;
for (int i =0; i < size; i++){
sum += print[i].payments;
}
return sum;
}
double calculateSalarySum(driver* drivers, int num){
double sum =0.0;
for (int i =0; i < num; i++){
sum += drivers[i].salary;
}
return sum;
} and this is the requirement There should be a company called Al-Barq for bus repair, cooperating with the president of a company called Shams Buses to transport students.
So that all drivers employed by the President of Shams Company deal with Al Barq Company to repair their cars
There is a wonderful advantage that the driver who takes care of his car with a weekly routine at the end of the month will be the employee of the month and will have a bonus to his salary and a discount with the lightning company and it printed

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

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

a. Did you express your anger verbally? Physically?

Answered: 1 week ago