Please help in Intro to C coding class it is C language
Since Arup enjoys many different activities, he often overbooks himself. In the past, this wasn’t a problem. Either he would simply go to parts of two events that coincided, or he’d simply call the person hosting one of the two events telling them he couldn’t make it. Normally, this didn’t cause a problem because none of his appointments were ones that he absolutely had to keep. But now that he’s getting married, his fiancée occasionally has very important tasks for him that he can’t simply call to get out of, if he has double-booked.
In this problem you will help Arup identify schedules that contain double booking and schedules that don’t. Though this problem can be solved in many ways, you’ll be asked to solve it in a specific manner.
You’ll be given a set of responsibilities/events Arup has over the course of a week. Your goal will simply be to determine if there are any overlapping events at all.
In particular, you’ll be given several weekly schedules. Each weekly schedule will be a list of events. Each listing of events will contain the day (0 – 6, where Sunday = 0, Saturday = 6), a start hour (0 – 23, where 0 is midnight, 23 is 11 pm), and an end hour (1 – 24, where 1 is 1am and 24 is midnight of the following day.) It is guaranteed that the end hour is greater than the start hour, so each event has a duration that is a positive integer number of hours.
Restrictions for Solution
In order to solve this problem use an integer array of size 168 (the number of hours in a week). Each slot in the array stands for one hour in the week. Assume that the week starts on Sunday. Thus, indexes 0 through 23 represent the 24 hours on Sunday. For example, index 0 represents midnight to 1 am and index 20 represents 8pm through 9pm. Similarly, indexes 24 through 47 represent Monday. The array should store all 0s (false) to indicate that the entire schedule is free before any of the data is read in.
When you read in each event for the week, you must go to the appropriate slots in the array for that time period and see IF they are already scheduled, which would indicate a conflict. If they are, you know a conflict exists. If not, set each of these indexes to 1 (true) to indicate that the time period is now taken. For example, if an event runs from 5pm – 8pm on Tuesday, then indexes 65, 66 and 67 should be set to 1.
Input Specification (schedule.txt)
The first line of the input file will contain a single positive integer, n, representing the number of schedules in the input file to check. The schedules will follow. The first line of each schedule will contain a positive integer, E (< 30), representing the number of events scheduled for the week. On each of the following E lines a single event will be listed for that schedule. In particular, each of these lines will have three integers: d (0 ≤ d < 7), s (0 ≤ s < 24), and e (s < e ≤ 24), representing the day, start hour and end hour of the event, respectively. (Note: Please read the input for this program directly from the file “schedule.txt” and do NOT prompt the user to enter a filename.)
Output Specification
For each schedule, output a single line of the following form IF the schedule has no conflicts:
Schedule #k: Good job, no conflicts!
If there is at least one conflict, output a single line of the following form:
Schedule #k: Sorry, you double booked yourself again.
where k (≤ n) represents the schedule number, starting at 1.
Note: PLEASE FOLLOW THIS SPECIFICATION EXACTLY. IT WILL MAKE GRADING GO MORE SMOOTHLY!!!
Sample Input File
2
10
0 8 12
1 8 12
2 8 12
3 8 12
4 8 12
5 8 12
6 8 12
3 12 15
4 20 22
5 18 20
3
1 13 18
2 8 17
1 17 20
C CODE:
#include<stdio.h>
#include<stdlib.h>
int main(){
FILE *fp;
int i,j;
int no=0;//For storing number of schedule
int day=0;//For storing number of day
fp= fopen("Scheduler.txt", "r");//Opening file in read
mode
if(fp==NULL){
printf("File not open\n");
return;
}
fscanf(fp, "%d", &no);//Storing number of
schedule
for(i=1;i<=no;i++){
int flag=0;
int hour[168]={0};//Initialise
array with 0
fscanf(fp, "%d", &day);
while(day--){
int
k,start,end;
fscanf(fp, "%d",
&k);
fscanf(fp, "%d",
&start);
fscanf(fp, "%d",
&end);
start+=k*24;//Logic for storing elements at particular day
end+=k*24;
for(j=start;j<end;j++){
if(hour[j]!=0)
flag=1;//checkign conflict of
schedule
hour[j]=1;
}
}
if(flag==1){
printf("Schedule
%d : Sorry, you double booked yourself again.\n",i);
}
else{
printf("Schedule
%d: Good job, no conflicts!\n",i);
}
}
fclose(fp);//closing file pointer
return 0;
}
OUTPUT:

PLEASE DO LIKE IF YOU LIKE AND DO COMMENT IF YOU ARE HAVING ANY DOUBT TO UNDERSTAND THE LOGIC
Please help in Intro to C coding class it is C language Since Arup enjoys many...
Language: C++ (Please show output) Part 1 - LIST Create an unsorted LIST class. Each list should be able to store 100 names. Part 2 - Create a Class ArrayListClass It will contain an array of 27 "list" classes. Next, create a Class in which is composed a array of 27 list classes. Ignore index 0... Indexes 1...26 correspond to the first letter of a Last name. Again - ignore index 0. index 1 is names starting with A, index...
please write C++ code to finish R0,R1,R2
Introduction In this assignment, you are going to develop a "Schedule Book System that runs in the command line environment. The system stores the schedule of events input by user and allows users to add view or delete events. You can assume that the system can at most store 100 events Each group is required to write a Win32 Console Application program called ScheduleBook.cpp The requirements are listed below. RO When the program...
Need this program ASAP
C++ language
1b. Write the implementation file timeClock.cpp for the class TimeClock. Com pile the file, and save it in the Chap 13 folder of your Student Data Files. 1c. Write a C++ program named weeklyPay.cpp to test your class Timeclock Your program should ask the user how many hours the user worked each day of the week. An object should be created for each day of the week with the number of hours for each...
Please formulate and solve the following problem. Problem 2: Consider a taxi company scheduling drivers for its taxis. The requirement for taxis varies from hour to hour because of customer demand as shown in the figure. Time 0 on the figure represents midnight, and times are shown with a 24 hour clock starting at midnight. For example, four taxis must run from midnight to 4 a.m., while eight taxis must run from 4 a.m. until 8 a.m. We assume that...
Java 8
Braces You are designing a compiler for a C++ program and need to check that braces in any given file are balanced Braces in a string are considered to be balanced if the following criteria are met: All braces must be closed. Braces come in pairs of the form 0.0andl1. The left brace opens the pair, and the right one closes it In any set of nested braces, the braces between any pair must be closed For example,...
Your professor is hoping to get a summer job flipping burgers at the local burger joint. His starting salary will be $7.25 per hour. However, there are certain incentives to encourage him to work extra hours. It is calculated as follows per day: •$7.25 for the first 6 hours he works per day, Monday through Friday .•$8.25 for the next 2 hours he works per day, Monday through Friday. •$11.25 for each hour he works over 8 hours in a...
Please help me!
For Problem 1, 2 and 3: You are required to submit three .c
files that contain the instructions that you have written to solve
the following problems. Place the C source code to solve the first
problem in a file called lab5a.c. Place the C source code to solve
the second problem in a file called lab5b.c. And place the C source
code to solve the third problem in a file called lab5c.c. Remember
to include your...
This program will make Maze game. Please Help in c++ Prompt the user for a file that contains the maze. Read it into a two-dimensional array Remember you can use inputStream.get(c) to read the next character from the inputStream. This will read whitespace and non-whitespace characters Don’t forget to read the newline character at the end of each line Print the maze to the screen from your array You should include a ‘*’ in your maze to indicate where the...
Please help me write in C++ language for Xcode. Thank you. In this lab you are going to write a time card processor program. Your program will read in a file called salary.txt. This file will include a department name at the top and then a list of names (string) with a set of hours following them. The file I test with could have a different number of employees and a different number of hours. There can be more than...
I need help in C++ assignment. please add statements and i am Xcode complier user. Requested files: CountDecades.cpp (Download) Maximum upload file size: 96 KiB Write a C++ program named CountDecades.cpp. In this program you will have two integer arrays. One named inputArray of size 20 containing the values: 83, 2, 23, 11, 97, 23, 41, 67, 16, 25, 1 , 4, 75, 92, 52, 6, 44, 81, 8, 64 in the order specified, and an empty integer array of...