Skip to content

This is a school project from Data Structures and Algorithms course where simulating the distribution of students to houses by sticking some restrictions. Not any complex data structures or algorithms are applied on this project just some arraylist structure is used. This is more like a warm-up project to course.

Notifications You must be signed in to change notification settings

cankobanz/dormitory-allocation-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Datalonya-Student-Houses-Simulator

This is a school project from Data Structures and Algorithms course where simulating the distribution of students to houses by sticking some restrictions. Not any complex data structures or algorithms are applied on this project just some arraylist structure is used. This is more like a warm-up project to course.

REFERENCE: Following explanation is formal project description that are written by assistants of the course CmpE250 (Fall 2021) in Bogazici University

1 Introduction

You are going to be implementing a Java program for simulating the distribution of student houses. You are going to be running this simulation by using the Java Collections Framework.

2 Details of the Project

The University of Datalonya offers houses for the students. All houses are for one student only. But they can be in various conditions: old, new, needs renovation, broken oven, broken shower, new kitchen, new bed etc. According to these conditions each house has a rating point between 0 and 10. Students study at the university up to 8 semesters. If they are located at a house, they stay until graduation. But each student has his/her own criterion on house selection. This criterion is a threshold on the house’s rating. For example, if the student wants a house with minimum rating 4, then he/she is not located at houses with rating 2 or 3 (any rating below 4) even if they are the only available houses. New allocations are made at the beginning of each semester. House and student lists are checked for new allocations if possible. Now you are enrolled at the University of Datalonya Dormitory Office. The current list of houses and students are transferred to you. From now on, you are responsible for the allocation of the houses. You are supposed to arrange the lists of houses and students in collections of your choice and simulate the allocations until all students in the list graduate. In your simulation, check for matching houses and students at every new semester. The output of your simulation is the list of students who cannot stay at any house.

3 Input/Output Format

3.1 Input Format

The input will be given as a file argument. There are two types of input lines: house lines and student lines. The input lines will be in mixed order. You can assume that the input file is error free. You don’t have check for data. A typical line for a house is like this: h There are 4 parts which are single-space separated in a line for a house. The first part, the letter h, is the house indicator. The second part, , is the id of the house. The third part, , is the duration as the number of semesters that the house is full. If the duration is 3, then this house will be available after 3 semesters. The last part, , is the rating which shows the good or bad condition of the house. A typical line for a student is like this: s There are 5 parts which are single-space separated in a line for a student. The first part, the letter s, is the student indicator. The second part, , is the student id. The third part, , is the name of the student. The fourth part, , is the duration as the number of semesters that the student will study at the University of Datalonya. For example, if the duration is 3, then this student will graduate after 3 semesters. Of course, max duration can be 8 for a student. The last part, , is the rating which shows the minimum rating criterion of the student to accept a house. For example, if the rating parameter for a student is 3.2, then this student can only stay at houses with rating equal to or greater than 3.2. Your simulation program should read the input file and create appropriate collections for students and houses. Then process these collections until all students graduate. Your program should process houses and students in their id order. For example if there are two houses with ids 1 and 3 that are available at the moment, first the house with id 1 is allocated if possible. For students, if there are two students with ids 123 and 126 whose rating criterion holds for a house, the student with id 123 gets the house.

3.2 Output Format

Your program should end when the waiting student list is empty. The output of your program is the list of students that couldn’t stay at any of the houses. You should create a .txt file and print one student name at a line. The output student list must be in ascending order of student id but only names will be printed in output file.

4 Examples

For the input data:
h 1 0 8
s 10 Ali 3 9
h 2 0 4
h 3 0 7
s 11 Melis 3 9
s 12 Ayse 5 4
h 4 6 9
s 13 Selim 5 3
h 5 5 5
The correct result is:
Ali
Melis

About

This is a school project from Data Structures and Algorithms course where simulating the distribution of students to houses by sticking some restrictions. Not any complex data structures or algorithms are applied on this project just some arraylist structure is used. This is more like a warm-up project to course.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages