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

Over the past several weeks you have been surveilling several executives attheir

ID: 3531532 • Letter: O

Question

Over the past several weeks you have been surveilling several executives attheir company. And they have a dark secret. These executives have been embezzling funds from various departments of their company for their own private uses. You have managed to gather data on each executive regarding how much they have embezzled from each department, and now you want to prepare a report for your legal team describing the severity of this embezzlement. In addition, report who you suspect is the ring-leader. More specifically, for each executive, you should print out how much money they embezzled in total. Furthermore, for each department, you should print out who was the prime offender (the person who embezzled the most money from that department) and how much they embezzled from that department. Finally, print out who you think is the ring-leader. Of course, the ring-leader would have embezzled more money than any other executive, so simply find that person.

Input Specification

Input will begin with a line single integer, N (1 <N< 50), the number of executives. On each of the following N lines there is a single word, the i

Explanation / Answer

/*

Name :

Date :

Summary :

*/

#include<stdio.h>

#define maxExecutives 50 //maximum number of Executives

#define maxExcNameLen 50 //maximum length of Executives name

#define maxDept 50 //maximum number of departments

#define maxDeptNameLen 50 //maximum lenght of department name

int main()

{

char Executive[maxExecutives][maxExcNameLen];

char Department[maxDept][maxDeptNameLen];

long int embezzelment[maxExecutives][maxDept];

int totalExecutives,totalDept;

scanf("%d",&totalExecutives);

int i;

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

scanf("%s",Executive[i]);

}

scanf("%d",&totalDept);

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

scanf("%s",Department[i]);

}

int j,ringLeader;

long int totEmb,maxTot=0;

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

totEmb=0;

for(j=0;j<totalDept;j++){

scanf("%ld",&embezzelment[i][j]);

totEmb+=embezzelment[i][j];

}

if(maxTot<totEmb){

maxTot=totEmb;

ringLeader=i;

}

printf("Mr. %s has embezzled $%ld ",Executive[i],totEmb);

}

long int maxEmb;

int id;

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

id=0;

maxEmb=0;

for(j=0;j<totalExecutives;j++){

if(maxEmb<Department[j][i]){

maxEmb=Department[j][i];

id=j;

}

}

printf("Mr. %s is the prime offender for the %s department ($%ld) ",Executive[id],Department[i],maxEmb);

}

printf("Mr. %s is the ring-leader! ",Executive[ringLeader]);

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote