EECS 2510 Project 2 — List of Presidents solution


Original Work


5/5 - (6 votes)

You will build two classes in this project. One to represent dates and a second to
represent a president of the United States. You will read in a list of presidents from an
input file, allow the user to input a number of commands to be performed, and, at the
end, output the possibly modified list to a file.
Dates will be in the form of: March 5, 1800. The must be stored as 3 individual parts
(day, month, and year). A president has a first name, middle name (possibly empty),
and a last name. There is a date they were inaugurated and the last day of their term.
Finally, there is the state they are from. The input file with this data is named “input.txt”
and the output file name should be output.txt. A sample input file will be posted to the
class BlackBoard web site.
The commands are given below:
L — list all the presidents and their information.
A — add a president
F state — print all the presidents from the given state.
P president — find and print the preceding president. There is possibly no
preceding president. In that case your program should print a message saying
N president — find and print next president. There is possibly no next president.
In that case your program should print a message saying that.
Q — quit after saving file.
Write it in pieces. I suggest getting the Date class working first, then build the president
class, and then start by reading in the input file. Implement the commands one at a time.
Your source files should be turned in on BlackBoard in the space provided,.