Urgent java project
In this assignment you are to write a program that keeps track of yours and your friends
DVD’s. The program should have the function to loan DVD’s. That means that you should
be able to borrow the dvd’s your friends own, and they should be able to borrow yours.
The program is to keep track of which dvd’s a person owns, which of those are loaned
out and who is borrowing them. And which DVD said person is borrowing from others.
File structure:
When the program runs/launches, it is to read from a file and create a data structure
from this.
When the program launches it is to read the file dvdarkiv.txt. The file contains
information about which persons should be in the system, which dvds they owns,
whether they are loaned out, and in that case; who is borrowing them. The file has the
following structure:
John
Marie

John
The hobbit 1
*The music man
Marie

Marie
All the persons who are included in the program are listed first. After all the names,
there is a dash (-), on its own line.
After that one and one person are listed. Under the name the DVDs that the persons
owns, are listed, one on each line. If the DVD is loaned out at the moment, there will be a
* before the name of the DVD. On the line below that, the person who is borrowing it will
be listed.
After each persons list of DVD’s there will be a dash (-).
Commandos:
There should also be a commando loop (perhaps a switch) which prints a menu.
It is to offer the following commandos:
1. New person.
Creates a new person (object) in the system. The program asks for the name of
the new person.
2. Buy.
Creates a new DVD (object) in the system. The program should ask for the
following:
Who has bought the DVD?
What is the title of the DVD?
Check if the person doesn’t already owns the DVD.
3. Borrow
Is used when a person want to borrow a DVD from another person. The program
should ask the following:
Who is loaning the DVD?
Who is he loaning it from?
What is the title of the DVD?
Check if the person actually owns the DVD, and it isn’t loaned to someone else.
And you can’t borrow from yourself.
4. Show person
Shows and overview of all the DVD’s on specific person owns and borrows at the
moment. The program should ask which person it is to show an overview for. If *
is entered, the overview is to include all persons in the system.
For each person the overview should show this:
The title of all DVD’s he/she owns.
Which of these that are loaned out, and who is borrowing them.
Which DVD’s the person has loaned from others, and whom they are
loaned from.
5. Show overview
Gives and overview of all person in the archive. For each person the following
should be included:
How many DVD’s said person owns.
How many said person is loaning out at the moment.
How many said person are loaning from others.
6. Return
Is used when a loaned DVD is returned to its owner. The person is to ask who has
loaned the DVD, and the title of the DVD.
Check that the DVD exists, and that is actually was loaned to said person.
7. Exit
Terminates the commando loop and the program
UML
The program should build on the following structure:
Try to make the code as “readable” as possible. And comment where needed.
loaned
DVDAdministration
Person
DVD
namelist
0…*
owner
archive
1
0…*
loaner
0…1
0…*
Loaned out
0…*