I'm trying to make a video store program that allows customers to search for videos and either buy or rent them. I have already made a class with 3 subclasses, VHS, DVD and VCD. for the meantime,When video objects are first put into the store, the status should be “IN”. Each time a video is rented, the status of that video is set to “OUT”. When a rented video is returned, the status is set back to “IN”. How do I use a boolean to do this?
And how to set a price for vhs, dvd and vcd individually
.
Video superclass:
package videos;
import java.io.*;
public abstract class Video implements Serializable{
public String vid_name;
public double vid_length;
public String vid_status;
//Constructor
public Video(String vidName, double vidLength)
{
vid_name= vidName;
vid_length=vidLength;
}
public String getVidName()
{
return vid_name;
}
public double getMovLength()
{
return vid_length;
}
public String getVidStatus() {
return vid_status;
}
public void setVidStatus(String vid_status) {
this.vid_status = vid_status;
}
public abstract boolean equals(String vid_name, String type); //abtract method to check for video existence
}
just gonna put my dvd class here because the vcd and vhs are pretty much similar:
package videos;
import java.io.*;
/**
*
* @author user
*/
public abstract class DVD extends Video implements Serializable{
private String _Director;
private double vid_price;
//Constructor
public DVD(String vidName, double vidLength )
{
super (vidName, vidLength);
}
public DVD(String vidName, double vidLength, double vidPrice, String Director )
{
super(vidName, vidLength);
_Director = Director;
vid_price=vidPrice;
this.vid_price=50.00;
}
public boolean equals(String vid_name, String type)
{
if (type.equalsIgnoreCase("DVD"))
{
if(type.equalsIgnoreCase(getVidName()))
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
the only boolean in this prgram will be used later for the customer to enquire about a specific video. my code is nt complete. I was thinking if I require another boolean to check for availability