Question: Requirements implement the functions listed. write the course design report. your report need a cover page and main contents should include objectives, design requirements, design

Requirements

implement the functions listed.

write the course design report.

your report need a cover page and main contents should include objectives, design requirements, design architecture, flowchart, function description, debugging problems, test analysis, etc.

report page size: A4, page number size: 10, line space: 18 pound and standard character spacing.

4Marking criteria

/*including libraries*/

#include

#include

/*Structure to store customer info*/

struct Cinfo{

char name[20];

int sex;

char tel[11];;

};

/*Structure to store PC info*/

struct PCInfo {

int state[6];

struct Cinfo waitlist[6];

int year;

int month;

int day;

};

/*Fucntion to browse Pc period on a given date */

void browse(struct PCInfo info[],int size,int day,int month,int year){

for(int i=0;i

/*if the pcInfo date is same as given*/

if(info[i].year==year && info[i].month==month && info[i].day==day){

/*Print its period*/

for(int j=0;j<6;j++){

printf("PC at time %d to %d is %d ",8+(2*j),10+(2*j),info[i].state[j]);

}

}

}

}

/*Fucntion to book a Pc at a given date */

void positionBooking(int day,int month,int year,struct PCInfo info[],int size){

for(int i=0;i

int flag=0;

/*Find pc with the given date*/

if(info[i].year==year && info[i].month==month && info[i].day==day){

/*check an available time period*/

for(int j=0;j<6;j++){

if(info[i].state[j]==0){

/*Book the pc at the free time period

with the customer details*/

printf("PC Booked at time %d to %d ",8+(2*i),10+(2*i));

printf("Enter customer name ");

scanf("%s",info[i].waitlist[j].name);

printf("Enter sex 1: Male , 2: Female ");

scanf("%d",&info[i].waitlist[j].sex);

printf("Enter telephone number ");

scanf("%s",info[i].waitlist[j].tel);

info[i].state[j]=1;

flag=1;

break;

}

}

if(flag){

break;

}

}

}

}

/*Function to cancel booking of a customer on a given day*/

void cancelBooking(int day,int month,int year,struct PCInfo info[],int size,char *name,int sex,char * tel){

for(int i=0;i

int flag=0;

/*find pc with the given date*/

if(info[i].year==year && info[i].month==month && info[i].day==day){

for(int j=0;j<6;j++){

/*Check if the customer Booking is present on the given date*/

if(strcmp(info[i].waitlist[j].name,name)==0 && info[i].waitlist[j].sex==sex && strcmp(info[i].waitlist[j].tel,tel)==0){

/*remove booking */

info[i].state[j]=0;

flag=1;

break;

}

}

if(flag){

break;

}

}

}

}

/*Function to inquiry about customer booking on the given date and period*/

void inquiry(int day, int month, int year,struct PCInfo info[],int size, int period){

for(int i=0;i

if(info[i].year==year && info[i].month==month && info[i].day==day){

/*if period is booked print customer details*/

if(info[i].state[period]==1){

printf("Name %s ",info[i].waitlist[period].name);

printf("Sex : %d ",info[i].waitlist[period].sex);

printf("Telephone : %s ",info[i].waitlist[period].tel);

break;

}

else{

printf("Period is available ");

break;

}

}

}

}

int main(){

/*create pc info array*/

struct PCInfo info[100];

int size=0;

/*Create 2 pc's */

info[0].day=20;

info[0].month=5;

info[0].year=2020;

size++;

info[1].day=25;

info[1].month=6;

info[1].year=2020;

size++;

printf(" Booking PC ");

positionBooking(20,5,2020,info,size);

printf(" Calling inquiry ");

inquiry(20,5,2020,info,2,0);

printf(" Browse PC periods ");

browse(info,size,20,5,2020);

printf(" CancelBooking ");

cancelBooking(20,5,2020,info,size,"saad",1,"1234");

printf(" Brose Pc periods after cancelling ");

browse(info,size,20,5,2020);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!