Homework #10 Solution

$30.00

Category:

Description

In this homework, you will write a simple database management system which reads information about a department in a university such as students, lectures, and professors and outputs a file which includes some summary information. The aim of this homework is to make you more familiar with structs and random and sequential file operations. Your program will read basic information from a random access file using structs and output a summary information as a sequential file. Example input and output files are given below. Please note that the input file will be a random access file instead of a sequential one given in this sheet for demonstration purposes.

 

Input File Format: There are 5 different data types (i.e. structs) in the file. Students (with id, name and surname), lecturers (with degree, id, name and surname), lectures ( with code, name and the id of the lecturer), schedule (with classroom name, day, start time of the lecture, duration of the lecture and the code of the lecture) and courses taken by the students (with student id and lecture code). The following is an example input file in the sequential form. At the beginning of each entry type is a number which indicates how many entries will be listed. For example, the first line indicates there are 3 students to be read. In the exact random access file, there will be no space or newline character between any of the information. The order of the data will be the same in all input files, i.e. first students, second lecturers, third lectures, etc..

input.dat

3

100 kerem inan

 

105 oya demir

420 nese kaplan

3

prof 222 ibrahim sogukpinar

prof 356 yakup genc

assis 789 mustafa tunali

5

 

101 programming 356

444 discrete 222

  • programming_lab 789
  • network 222
  • algorithms 356

 

Z23 Tue 10 2 101

 

Z06 Thu 14 1 444 BM101 Wed 11 3 321

 

 

Z20Lab Fri 14 3 108 BM207 Mon 9 3 521

 

  • 101
  • 521

 

  • 521
  • 444
  • 321
  • 101
  • 108

 

 

 

 

 

Output file format: Output file will include some relations about the data in the input file. The first summary will be lecture, lecturer and student relation. Namely, for each lecture its name, the name and surname of the lecturer and the number of students that takes the lecture will be listed. Secondly, the student-lecture relation will be listed, i.e for each student, his student id, name, surname and how many lectures he takes. The last summary is about student schedules, i.e. his student id, name, surname, and the days on which he has class.

 

output.txt

Lecture-Lecturer

programming yakup genç 2

discrete Ibrahim sogukpinar 1

 

programing_lab mustafa tunalı 1

network ibrahim sogukpinar 1

algorithms yakup genc 2

 

Student-Lecture

  • kerem inan 3
  • oya demir 2
  • nese kaplan 2

 

Student-Day

100 kerem inan Tue, Mon, Fri

105 oya demir Mon, Wed

420 nese kaplan Thu,Tue

 

 

 

An example input.dat file is provided with the homework definition. Please note that your homework will be tested on another input file, so your program should handle any input file with the given format, for example varying number of student, lecture numbers. When defining your structs, use 30 length character arrays for string variables and integer for numeric variables to be able to read the input file properly. Do not change the format of the output file and do not write any additional info or explanation.

 

 

 

#notes

  • You are free to write any additional functions.

 

  • Do not change the input and output file names and formats! Different file names or formats will not be accepted.

 

  • The assignment must be your original work. Duplicate or very similar assignments are both going to be considered as cheating.

 

  • Submit your homework via KADI.
  • Ask your questions via moodle.

error: Content is protected !!