代做assignment | C代做 | 数据结构代写 – Programming assignment #4 – Commands, Sorted List, Separate C file

TITLE

代做assignment – , 这个项目是assignment代写的代写题目

ass代做 assignment代写 代写assignment

Programming assignment #4 – Commands, Sorted List, Separate C file(40 pts)

This assignment is similar to #3 except

 You must sort the Courses List. Print it before sorting, after sorting, and after all the students
have been processed.
 Instead of a student registration file, we will have a command file.
 You will be provided with a driver program (cs1713p4Driver.c) (see below)
 Your code must be created in a separate C file (cs1713p4.c). (see below)
 There is a new include file, cs1713p4.h
 The output is different due to the driver printing the commands as they are encountered.
Please see the sample output.

Input:

Course same as Programming Assignment #3 although there may be different data.

Command This is different from the previous assignment. The file contains text in the form of commands. STUDENT BEGIN szStudentId cGender szBirthDt szFullName specifies the beginning of student and includes all the identification information from program 3. STUDENT INFO szMajor,szEmail,dGpa,cIntl specifies the information for a student (separated by commas) STUDENT REQUEST szCourseId specifies a single course request. Steps: Print the course ID Lookup the course ID, If not found, print a warning (but do not terminate your program) and return. If found, reduce the number of seats for that course by 1 Print the fees. Accumulate the total fees for this student. CUSTOMER COMPLETE specifies the completion of the list of flight requests for a customer. Print the total cost for this customer. (Takes the place of END) COURSE INCREASE szCourseId iQuantity increase the available seats for a course by the specified quantity. COURSE SHOW szCourseId requests a display of a particular course. Show all of its information.

Driver program (green highlighting means you have done most of this previously, yellow highlighting means new functionality): You will be provided with a driver program, cs1713p4Driver.c which

  1. invokes the driver’s processCommandSwitches
  2. invokes your getCourses to read the original course information.
  3. invokes your printCourses to print the original course information
  4. invokes your sortCourses to sort the original course information
  5. invokes your printCourses to print the sorted course information
  6. invokes a driver-provided processCommands which o reads input lines from the command file until eof: prints the input line determines command and subcommand invokes either
 your processStudentCommand to process a STUDENT subcommand
(you should be able to reuse some of your program 2 code,
although you must change it)
 your processCourseCommand to process a COURSE subcommand
  1. invokes your printFlights to print the resulting flight information Your cs1713p4.c code: You have been furnished with skeletal code for cs1713p4.c Your code will be in the file cs1713p4.c. You must not place it in the cs1713p4Driver.c file. It does the following includes: #include <stdio.h> #include <string.h> #include “cs1713p3.h” It must not include cs1713p4Driver.c within your cs1713p4.c file. Look at the notes below on compiling. The “link” step is where the functions you call in the driver and the functions the driver calls in your code get resolved. You must create the following routines (see the include file): o getCourses- reads and returns the courses as a linked list (most of this is in program #3) o printCourses – prints the course information (most of this is in program #3) o sortCourses – sorts the course information using an insertion sort (see your course notes) o searchCourses – find a course ID in the sorted course list. You will use this in your routines. o processStudentCommand – processes the various STUDENT commands (most of this is in program #3) o processCourseCommand – processes the various COURSE commands Please review the cs1713p4.h include file. Compiling: (Before doing these steps, make a copy of your code called cs1713p3Saved.c in case you incorrectly type them and wipe out your .c file.) also I suggest creating a makefile so you can repeat this process easily Compile the driver using gcc -g -c -o cs1713p4Driver.o cs1713p4Driver.c
(you can do this instead: gcc -g -c cs1713p4Driver.c
causing it to automatically create the cs1713p3Driver.o)
 Compile your code using
gcc -g -c -o cs1713p4.o cs1713p4.c
(you can do this instead: gcc -g -c cs1713p4.c
causing it to automatically create the cs1713p4.o)
 Link them together using:
gcc -g -o register cs1713p4Driver.o cs1713p4.o

Executing the p3 executable: register -c p4Command.txt -f p4Courses.txt

Turn in: Your include file (if it changed) Your C code Your output based on the data provided.

Initial Courses

****************************************** Courses ****************************************** Course ID Room Number Days Times Seats Fees HIS1043.002 MH2.102 MWF 1:00-1:50pm 120 35. GEO1013.005 MB1.101 TR 12:30-1:45pm 5 35. MAT1214.003 MS1.02.03 TR 2:00-3:15pm 1 35. CS1713.002 NPB1.202 MWF 1:00-1:50pm 0 50. MAT3013.001 MS1.02.07 TR 2:00-3:15pm 1 35. ENG1023.001 MS1.02.07 MWF 10:00-10:50am 15 35. ART2113.001 AR4.01 TR 11:30-12:45pm 10 45. ART3023.001 AR4.04 MWF 12:00-1:50pm 7 35.

Sorted Courses

****************************************** Courses ****************************************** Course ID Room Number Days Times Seats Fees ART3023.001 AR4.04 MWF 12:00-1:50pm 7 35. ART2113.001 AR4.01 TR 11:30-12:45pm 10 45. CS1713.002 NPB1.202 MWF 1:00-1:50pm 0 50. ENG1023.001 MS1.02.07 MWF 10:00-10:50am 15 35. GEO1013.005 MB1.101 TR 12:30-1:45pm 5 35. HIS1043.002 MH2.102 MWF 1:00-1:50pm 120 35. MAT1214.003 MS1.02.03 TR 2:00-3:15pm 1 35. MAT3013.001 MS1.02.07 TR 2:00-3:15pm 1 35.

STUDENT BEGIN pte357 M 1986/01/01 Pete Moss pte357 Pete Moss (M 1986/01/01) STUDENT INFO CS,[email protected],3.20,N CS [email protected] INTL:N GPA:3. STUDENT REGISTER HIS1043. STUDENT REGISTER GEO1013.005 $35. STUDENT REGISTER MAT1214.003 $35. STUDENT REGISTER CS1713.002 $35.00 not enough available seats to satisfy request STUDENT COMPLETE Total Fees: $70. COURSE INCREASE HIS1043.002 10 COURSE SHOW HIS1043. HIS1043.002 MH2.102 MWF 1:00-1:50pm 130 35.

****************************************** Courses ****************************************** Course ID Room Number Days Times Seats Fees ART2113.001 AR4.01 TR 11:30-12:45pm 10 45. ART3023.001 AR4.04 MWF 12:00-1:50pm 7 35. CS1713.002 NPB1.202 MWF 1:00-1:50pm 0 50. ENG1023.001 MS1.02.07 MWF 10:00-10:50am 15 35. GEO1013.005 MB1.101 TR 12:30-1:45pm 4 35. HIS1043.002 MH2.102 MWF 1:00-1:50pm 120 35. MAT1214.003 MS1.02.03 TR 2:00-3:15pm 0 35. MAT3013.001 MS1.02.07 TR 2:00-3:15pm 1 35.