Solved: 2. High School Scheduler In this problem you will design and implement a program that tells you the time of each class.

C programming

2. High School Scheduler In this problem you will design and implement a program that tells you the time of each class. The program will prompt the user for the class and you will output the time. For example, you will be provided with the following text file. Class Schedule: Class Time Physics 15:30 Calculus 9:00 Biology 14:30 Study Hall 10:30 Chemistry 11:30 All of your code should be placed in one file, highSchoolScheduler.c; the program accepts the file name as a command line argument so that it is executable like this: ./highSchoolScheduler schedule.txt. In the input text file the times will be in military times, and you will have to convert them to regular time. Your converted time should be displayed either in PM or AM.

Sample Output: 3 What class do you want to search for? Physics Physics is at 3:30 PM

What you will submit via handin: highSchoolScheduler.c.

schedule.txt///////

Class Schedule

Class    Time

Physics    15:30

Calculus   9:00

Biology    14:30

Chemistry    11:30

Expert Answer

 

Solved: 2. High School Scheduler In this problem you will design and implement a program that tells you the time of each class. 1Solved: 2. High School Scheduler In this problem you will design and implement a program that tells you the time of each class. 2Solved: 2. High School Scheduler In this problem you will design and implement a program that tells you the time of each class. 3Solved: 2. High School Scheduler In this problem you will design and implement a program that tells you the time of each class. 4copyable code:

// Declare a header files

#include <stdio.h>

#include <stdlib.h>

#include<string.h>

// Main program

int main()

{

//Add required variables

char Class[6][20];

int Timing_Hr[6];

int Timing_min[6];

char Mil_time[6][20];

char Head[50], Sch_Header[50];

char Searching_Class[50];

int i = 0, k = 0, Total, Find = 0;

FILE * fp;

//Read text file

fp = fopen(“schedule.txt”, “r+”);

//Reads the first line

fscanf(fp, “%[^n]n”, Head);

//Reads the first line

fscanf(fp, “%[^n]n”, Sch_Header);

// checks the while condition

while (fscanf(fp, “%st%d:%d”, Class[i], &Timing_Hr[i], &Timing_min[i]) != EOF)

{

//checks the if conditions

if (Timing_Hr[i]>12)

{

// copying the militatry time

strcpy(Mil_time[i], “PM”);

Timing_Hr[i] = Timing_Hr[i] – 12;

}

else

{

// copying the militatry time

strcpy(Mil_time[i], “AM”);

}

// increment the i

i++;

}

// assign the total value

Total = i – 1;

// getting the search subjects

printf(“Enter the Name of Class That You Search.? “);

gets(Searching_Class);

for (i = 0;i<Total;i++)

{

// checks the endof file

if (Searching_Class[k] == ‘’)

{

printf(“Foundn”);

}

// checks and compare the files

if (strcmp(Class[i], Searching_Class) == 0)

{

// display the class time etc

printf(“%s is at %d:%d %sn”, Class[i], Timing_Hr[i], Timing_min[i], Mil_time[i]);

Find = 1;

break;

}

}

// checks the find equal to zero

if (Find == 0)

{

printf(” The following Classes information are Not Found !n”);

}

//Close file

fclose(fp);

return 0;

}

Still stressed from student homework?
Get quality assistance from academic writers!