Netflix based java project
So before anyone gets suspicious this IS HOMEWORK. So please don't waste your time posting "Do your own homework" because I am NOT asking for answers. Now that I have that out of the way.
Below I have posted the assignment:
Quote:
Your task is to come up with an object-oriented design for a streaming movie rental system
(like NetFlix). The names of your classes, private instance variables, methods etc. are totally
up to you.
Specication
Every user has the following information associated with them:
A name.
An account number.
An ordered playlist of movies. In particular, if movie A is before movie B in the playlist, then the user watches A before B.
The five most recent movies that the user has watched.
There are three different kinds of users:
Trial: A trial user can only have one movie in their playlist at a time.
Members: A member can have up to 5 movies in their playlist at a time.
VIP Members: A VIP member can have an unlimited number of movies in their playlist.
Every user must be able to do the following operations:
Check-out a movie. If a user checks out a movie, then it is put at the end of the user's playlist.
Watch a movie: If a user watches a movie, then the movie is removed from the user's playlist. You may assume that the user can only watch whatever movie is at the front of the playlist.
Recall the five most recent movies that they have watched: This operation should print the most recent movies that the user has watched to the screen.
Every movie contains the following information:
A title.
A date.
A genre.
A rental price.
Notice that different users have different movie rental rights, so it is possible that a user willattempt to do something that (s)he is not allowed to do. When this occurs, you must do thefollowing:
Make sure that the operation is not performed.
Print an informative error message that states why the operation could not be performed.
Your object-oriented design must include the following object-oriented features:
An abstract class. What should be the base class that other classes build o of?
Inheritance. In particular, you must inherit from a base abstract class.
Polymorphism (Dynamic Binding). In particular, your method for checking a movie out must be polymorphic.
So I know that is a lot of info but I am kinda confused. I have already created the "Movie" class (below)
Code :
import java.util.Date;
public class Movie {
private String title;
private String genre;
private int price = 1;
private Date d1 = new Date();
public Movie(String title, int day, int month, int year, String genre,
int price) {
super();
this.title = title;
this.genre = genre;
this.price = price;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String toString()
{
return "Title is: " + title +"\n" + "Today's date is: " + d1 + "\n" + "Genre: " + genre + "\n" + "Rental price is: " + price;
}
}
QUESTIONS FOR THE FORUM
I am working on the "User" class. but I am stuck now because I do not know what I should put into this user class.
Should I create three separate classes for the three types of memberships or should I just add them ALL into the "User" class. and how would I go about doing this?
I have a hard time thinking without a skeleton code, could some one help me create a skeleton so I at least know where to BEGIN.
Thanks again for this wonderful community, I would be failing this course if it was not for this site.
Re: Netflix based java project
Consider creating a User class and a UserState class or enum (better the latter). A User will have a UserState field, and depending on its value, will have different allowed behaviors.
Re: Netflix based java project
If you struggle with this type of thing I'd recommend reading the book Beginning Java Objects: From Concepts to Code by Jacquie Barker if you haven't already done so. I found it to be excellent and perfect for getting on the right track for learning how to create software out of objects.