Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data Engineers regularly collect, process and store data. In this task you will develop a deeper understanding of how C programming language can be used

image text in transcribedimage text in transcribed

Data Engineers regularly collect, process and store data. In this task you will develop a deeper understanding of how C programming language can be used for collecting, processing and storing data. In this assignment you get the opportunity to build an interactive program that can manage a list of students in a class.

The list is stored as an array of student_t type structures

student_t studentlist [MAX_CLASS_SIZE];

The student_t is a structure typedef for struct student. The struct student contains the following fields

  • name - array of MAX_NAME_SIZE chars (string)
  • gpa - a float between 0.0 and 4.0
  • birthday - a structure of date_t type as defined below.

Note that we now have a struct nested within a struct. The birthday is a structure typedef for struct date. The struct date_t contains the following fields,

  • day - integer between 1 and 31 (inclusive)
  • month - integer between 1 and 12 (inclusive)
  • year - unsigned integer between 1800 and 2017

Your program interacts with the nested struct array in your memory (RAM) and simple database file in your hard disk. It should provide the following features:

1. add student

Add a new student to the studentlist through the terminal. You should collect the input by asking multiple questions from the user.

Enter name> Enter birthday: day> Enter birthday: month> Enter birthday: year> Enter GPA>

2. delete last student

Remove the last student from the studentlist. TIP: you cannot delete an element from an array. Instead consider using an integer to keep count of number of students.

3. display student list

Display the list of students in the following format as shown in the sample run. Please follow the sample executable for the exact display format, including white spaces.

Name Birthday GPA ---------- ---------- ------ bee 10-01-1800 4.0000

Pay attention to the strict formatting guide:

  • Name - left aligned, 10 chars at most.
  • Date - 2 digit day, 2 digit month, 4 digit year
  • GPA 4 decimal places

4. save the student list to the database file

Save the studentlist in the hard disk as a binary/text file named database. You may use your own format to save the data. You should overwrite if database file already exists.

5. read the student list from the database file

Read the database file and put the data into studentlist. You may only read the data files created by your own program. You should overwrite the studentlist array you had in memory when loading from the file.

Can someone provide me with a smaple source code for this. i am really lost. Thanks

Description Data Engineers regularly collect, process and store data. In this task you will develop a deeper understanding of how C programming language can be used for collecting processing and storing data. In this assignment you get the opportunity to build an interactive program that can manage a list of students in a class. The list is stored as an array of student_t type structures student_t studentlist [MAX_CLASS_SIZE]; The student_t is a structure typedef for struct student. The struct student contains the following fields name - array of MAX_NAME_SIZE chars (string) gpa - a float between 0.0 and 4.0 birthday - a structure of date_t type as defined below. Note that we now have a struct nested within a struct. The birthday is a structure typedef for struct date. The struct date_t contains the following fields, day - integer between 1 and 31 (inclusive) month - integer between 1 and 12 (inclusive) year - unsigned integer between 1800 and 2017 Your program interacts with the nested struct array in your memory (RAM) and simple database file in your hard disk. It should provide the following features: 1. add student Add a new student to the studentlist through the terminal. You should collect the input by asking multiple questions from the user. Enter name> Enter birthday: day> Enter birthday: month> Enter birthday: year> Enter GPA 2. delete last student Remove the last student from the studentlist. TIP: you cannot delete an element from an array. Instead consider using an integer to keep count of number of students. 3. display student list Display the list of students in the following format as shown in the sample run. Please follow the sample executable for the exact display format, including white spaces. Name Birthday GPA bee 18-81 - 1800 4.0000 OR. C:\Windows\system32\cmd.exe 6. exit the program Enter your choices 1. add student 2. delete last student 3. display student list 4. save the student list to the database 5. read the student list from the database 6. exit the program Enter your choice3 Name Birthday GPA bee 10-01-1800 4.0000 10 chars 10 chars 6 chars 1. add student 2. delete last student 3. display student list 4. save the student list to the database 5. read the student list from the database 6. exit the program Enter your choice>6 C:\Users\127342|A2> Pay attention to the strict formatting guide: Name - left aligned, 10 chars at most. Date - 2 digit day, 2 digit month, 4 digit year GPA-4 decimal places 4. save the student list to the database file Save the studentlist in the hard disk as a binary/text file named database. You may use your own format to save the data. You should overwrite if database file already exists. 5. read the student list from the database file Read the database file and put the data into studentlist. You may only read the data files created by your own program. You should overwrite the studentlist array you had in memory when loading from the file. 6. exit the program Exit the interactive program. The database file It is up to you to create your own data storage format for the database file. Your program should be able to read the database that was created by itself. You can create the database as a text or binary file. You do NOT need to be able to create a database identical to the database of the sample executable. You do NOT need to be able to read the database of the sample executable. Your approach First step for the assignment should be to read this specification very carefully. Then play with the sample executable. Understand how it works, try different inputs. You will only understand the task fully if you spend a reasonable time experimenting with the executable. Breakdown the task into small measurable subtasks that can be achieved with functions, and then implement one at a time. Begin by taking small steps. Create a program that does not necessarily do all that is eventually required. Add to it slowly and methodically testing it on each occasion. Do not try to write a program that meets all the requirements in one step - this will not save you time. TEST TEST TEST! Testing is a core part of programming. You should thoroughly test your program to make sure the behaviour is identical to the sample executable. We will provide you with test cases - think yourself. The more testing you do, higher your chances are to get a good grade for the functionality. If your program crashes unexpectedly, or it runs but does not give the correct output, then you need to think of using a debugging strategy to determine the nature of the fault. For example, you can place printf(statements at significant points in your source code to print messages enabling you to trace execution of the program. You can also use comment delimiters to temporarily remove parts of the source code from the compilation process. You will lose marks if you do not follow the instructions in the template file. Do NOT hard-code your solution. When writing the code, the first step is to define the struct student and struct date with the fields mentioned above - do NOT add extra fields. Inside the main, you can define the studentlist as an array of student_t type- do NOT define this array as a global variable. To start with, assume all user input is perfect (within the range, correct datatype). Work on adding a student, then on displaying the studentlist. You could then progressively work your way through other features. Do not worry about some months not having dates 29-31 and leap years. That means 30-02-1900 is a real date, although the month of Feb does not have a day 30. Only the range conditions mentioned before apply

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Find the derivative. f(x) 8 3 4 mix X O 4 x32 4 x32 3 -4x - x2

Answered: 1 week ago