代写日程表应用,练习Stack的用法。
Goal
In this project you will help determine the best of times for tutoring
services for a class based upon student availability. The input to the program
will be the information provided by the student, including the student ID,
days of the week, and hours the student can attend tutoring. The output is a
list days and time periods that will maximize the numbers of students who can
attend at least 1 hour of tutoring. Make sure you look at the examples to
understand the goal. The goal is not to pick the days and times noted by the
most students, but rather dates and times that serve the maximum number of
different students.
Objectives
The goal of this programming project is for you to master (or at least get
practice on) the following tasks:
- working with balanced expressions
- reading data from input files
- using the provided Stack class
- writing classes
- working with existing code
Input Dataset
( )
are the symbols surrounding student data< >
are the symbols surrounding day of the week data[ ]
are the symbols surrounding the time period.
For example:
(A Smith <M [0900][1000][1100]> <H [1400]>
) ( S Jones <T [2100][1800]>
) means A Smith can go to tutoring on Mondays from 9-11, and Thursday 2-3,
and S Jones can go on Tuesday from 6-7 and 9-10. Note the period order is not
significant. There are no implied ranges.
Assume the only tutoring days are M,T,W,H,F and the hours are from 0900 to
2100, hence the last hour is 2100 (9PM – 10 PM). Also assume there are no
spaces or line breaks in the input, and that every student will have a unique
name.
Program Logic
This two-dimensional array can be used to store the various students who can
come for tutoring in that time period.
The first part of your program should read the input ,data validate its
format, and populate the array. You must use a Stack as to interpret the
Expression. Your program should prompt the user for which test dataset to run.
The user should enter 1 for test dataset 1, ..up to n (depending on the number
you provide.
The second part should analyze the array to pick 3 time slots that covers the
most different students.
For example, in the abbreviated schedule below,Thursday at 1200, Wednesday at
0900 and Friday at 1000 would cover the most (in this case all) students. Each
cell represents the students who can attend tutoring at that time period.
Time | M | T | W | H | F |
---|---|---|---|---|---|
0900 | A B C | F H | A C G | A B | |
1000 | C | B | B | D | |
1100 | A | ||||
1200 | C | A B D | A B C G | ||
1300 | A B G | G | |||
1400 | |||||
Your program should do the following: |
- Read the student data from one input file. There will be many records, each giving information about one or more students.
- Throw Exceptions for ill formed expressions. However after reading an ill-formed expression, read the next record from the file.
- Use a stack to interpret the data input
- Store the student information in the 2 dimensional array
- Interpret the array to find the best 3 slots to cover the most students.
Running the program
The zipped java project file, which contains all your source code, input files
and Eclipse related projects, is to be submitted You may include more than one
test file to indicate your program is working.
You are responsible for making sample test cases (at least 3) as well as
running the sets provided.