1)Write in a pyhton program with using database

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

1)Write in a pyhton program with using database

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
int chart[10][5];
int workerarray[6];
int worker,worker1,worker2;
int selection,i;
srand (time (NULL));
do{
selection=monu();
switch(selection)
{
case 0:
printf("program terminated");
break;
case 1:
fill(chart,workerarray);
chartprint(chart);
break;
case 2:
printf("\nEnter Employees to Replace:");
scanf("%d%d",&worker1,&worker2);
change(chart,worker1,worker2);
break;
case 3:
printf("\nEmployee Who Will Be Asked for Weekly Work Details?");
scanf("%d",&worker);
daymonthwrite(chart,worker);
break;
default:
printf("\n incorrect entry \a\n");
}

}while(selection!=0);
return 0;
}
int menu()
{
int selection;
printf("\n_____MENU_____ \n");
printf("0- Close Program \n");
printf("1- Print Weekly Chart \n");
printf("2- Replace Employees \n");
printf("3- Get Employee Weekly Work Details \n");
printf("___________ \n");
printf("your choice : ");
scanf("%d",&selection);
return selection;
}

void fill(int array[][5],int array2[])
{

int i;
int n;
for(i=1;i<6;i++)
{
array2[i]=10;
}
printf("\n");
int value;
for(n=0;n<10;n++){

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

value=rand () % 5 + 1;

if(workercheck(array2,value)==-1){
i--;
continue;
}
else
array[n][i]=value;

}

}
}
int workercheck(int valuegenerated[],int value)
{
if(valuegenerated[value]!=0)
{
valuegenerated[value]--;
return 1;
}

else
return -1;
}
int chartprint(int dizi[][5])
{
printf("\t Monday Tuesday Wednesday Thursday Friday\n");
int n, i;
for(n=0;n<10;n++){
printf("%d. December:\t",n+1);
for(i=0;i<5;++i)
{
printf("%d\t",array[n][i]);
}
printf("\n");
}
}

void change(int array[][5],int c1,int c2)
{
int n,i;
int array2[10][5]={0};
for(n=0;n<10;n++){

for(i=0;i<5;++i)
{
if(array[n][i]==c2)
array2[n][i]=c2;
}
}


for(n=0;n<10;n++){

for(i=0;i<5;++i)
{
if(array[n][i]==c1)
{

array[n][i]=c2;
}
}
}

for(n=0;n<10;n++){

for(i=0;i<5;++i)
{
if(array[n][i]-array2[n][i]==0)
{
array[n][i]=c1;
}
}
}
printf("Process finished\n");
chartprint(array);
}
void daymonthwrite(int array[][5],int c)
{
int n,m;
for(n=0;n<10;n++)
for(m=0;m<5;m++)
if(array[n][m]==c)
{
printf("%d. December\t",n+1);
daycall(m);
printf("\n");
}
}

void daycall(int n)
{
switch(n)
{
case 0:
printf("Monday");
break;
case 1:
printf("Tuesday");
break;
case 2:
printf("Wednesday");
break;
case 3:
printf("Thursday");
break;
case 4:
printf("Friday");
break;

}
}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Stack
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
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