DVD管理系统:为某音像店开发一个迷你DVD管理器,实现DVD碟片的管理,包括如下功能:



package com.sxt.oop.dvd;
/**
 * DVD类
 * @author ty
 *
 */

public class Dvd implements Comparable<Dvd>{
 //存放DVD名
 private String dvdNames ;
 //存放借出状态的数组,false为可借,true为不可借
 private boolean status ;
 //存放借DVD日期
 private String loanDates ;
 //DVD借出次数
 private int count;
 /**
  * 构造方法
  */
 public Dvd(){
  
 }

 public Dvd(String dvdNames) {
  this.dvdNames = dvdNames;
 }
 public Dvd(String dvdNames, boolean status, String loanDates) {
  super();
  this.dvdNames = dvdNames;
  this.status = status;
  this.loanDates = loanDates;
 }
 /**
  * set get方法
  * @return
  */
 public String getDvdNames() {
  return dvdNames;
 }
 public void setDvdNames(String dvdNames) {
  this.dvdNames = dvdNames;
 }
 public boolean isStatus() {
  return status;
 }
 public void setStatus(boolean status) {
  this.status = status;
 }
 public String getLoanDates() {
  return loanDates;
 }
 public void setLoanDates(String loanDates) {
  this.loanDates = loanDates;
 }
 
 public int getCount() {
  return count;
 }

 public void setCount(int count) {
  this.count = count;
 }

 @Override
 public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result
    + ((dvdNames == null) ? 0 : dvdNames.hashCode());
  result = prime * result
    + ((loanDates == null) ? 0 : loanDates.hashCode());
  result = prime * result + (status ? 1231 : 1237);
  return result;
 }
 @Override
 public boolean equals(Object obj) {
  if (this == obj)
   return true;
  if (obj == null)
   return false;
  if (getClass() != obj.getClass())
   return false;
  Dvd other = (Dvd) obj;
  if (dvdNames == null) {
   if (other.dvdNames != null)
    return false;
  } else if (!dvdNames.equals(other.dvdNames))
   return false;
  if (loanDates == null) {
   if (other.loanDates != null)
    return false;
  } else if (!loanDates.equals(other.loanDates))
   return false;
  if (status != other.status)
   return false;
  return true;
 }
 @Override
 public String toString() {
  return   (status?"已借出":"可借")+"\t\t<<"+dvdNames+">>\t\t\t"+(loanDates==null?"":loanDates)+"\t\t"+count+"\n";
 }
 /**
  * 比较借出次数的方法
  */
 @Override
 public int compareTo(Dvd o) {
  return o.count-this.count;
 }
 /**
  * 借出次数自增方法
  */
 public void increment(){
  count++;
 }
 
}


package com.sxt.oop.dvd;

import java.text.ParseException;
impo

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值