Java Your program must read a file called personin.txt.  Each line of the file will be a person's name, the time they arrived at the professor's office, and the amount of time they want to meet with the professor.  These entries will be sorted by the time the person arrived.   Your program must then print out a schedule for the day, printing each person's arrival, and printing when each person goes in to meet with the professor.  You need to print the events in order of the time they happen.  In other words, your output will be sorted by the arrival times and the times the person goes into the professor's office. In your output you need to print out a schedule.  In the schedule, new students go to the end of the line.  Whenever the professor is free, the professor will either meet with the first person in line, or meet with the first person in line if nobody is waiting.  Assume no two people arrive at the same time. You should solve this problem using a stack and a queue. You can only use the operations: push, pop and isEmpty for Stack, or enqueue, dequeue and isEmpty for Queue, or their equivalents

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Java

Your program must read a file called personin.txt.  Each line of the file will be a person's name, the time they arrived at the professor's office, and the amount of time they want to meet with the professor.  These entries will be sorted by the time the person arrived.  

Your program must then print out a schedule for the day, printing each person's arrival, and printing when each person goes in to meet with the professor.  You need to print the events in order of the time they happen.  In other words, your output will be sorted by the arrival times and the times the person goes into the professor's office.

In your output you need to print out a schedule.  In the schedule, new students go to the end of the line.  Whenever the professor is free, the professor will either meet with the first person in line, or meet with the first person in line if nobody is waiting.  Assume no two people arrive at the same time.

You should solve this problem using a stack and a queue. You can only use the operations: push, pop and isEmpty for Stack, or enqueue, dequeue and isEmpty for Queue, or their equivalents.

Example file:
ann 10 5
astro 12 2
barb 14 6
bill 20 6
carl 22 7
Transcribed Image Text:Example file: ann 10 5 astro 12 2 barb 14 6 bill 20 6 carl 22 7
ann arrives at 10 and requests a meeting of length 5
ann meets from 10 to 15
astro arrives at 12 and requests a meeting of length
2
barb arrives at 14 and requests a meeting of length
6
astro meets from 15 to 17
barb meets from 17 to 23
bill arrives at 20 and requests a meeting of length 6
carl arrives at 22 and requests a meeting of length 7
bill meets from 23 to 29
carl meets from 29 to 36
Transcribed Image Text:ann arrives at 10 and requests a meeting of length 5 ann meets from 10 to 15 astro arrives at 12 and requests a meeting of length 2 barb arrives at 14 and requests a meeting of length 6 astro meets from 15 to 17 barb meets from 17 to 23 bill arrives at 20 and requests a meeting of length 6 carl arrives at 22 and requests a meeting of length 7 bill meets from 23 to 29 carl meets from 29 to 36
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education