1、迷你DVD管理器java实 验 报 告 课程名称:面向对象信息系统开发 实 验:期中大作业 班 级:02 学生姓名:李康 序 号:34 学 号:20231060261 专 业:电子信息工程 指导教师:高莲 学 期:2023-2023学年春季学期 成 绩: 云南大学信息学院 请用Java编程语言编写一个迷你DVD管理器,实现功能具体如下:x新增DVD x查看DVD x删除DVD x借出DVD x归还DVD 说明: 1、DVD相关信息如下:DVD的名称、是否可以借出,借出时间,租金每天多少钱、借出次数。 2、程序开始时,对数组进行初给化:3、编写采单,实现功能选择,用控制语句实现: 4、DVD借出
2、后请计算租金:5、根据每张碟的借出次数对DVD进行排序并输出。 源代码: 1. package dvd; import java.util.Scanner; /xx x x author d x/ public class DVD implements add,back,delete,lend,look Scanner input = new Scanner(System.in); private String name; private String yesorno; private int money; private int days; private int times; privat
3、e int nowdays; private String result; DVD() DVD(String name,String yesorno,int money,int days,int times,int nowdays,String result) this.name=name; this.yesorno=yesorno; this.money=money; this.days=days; this.times=times; this.nowdays=nowdays; this.result=result; public void getadd() System.out.print
4、(“请输入该DVD名称:“); this.name = input.nextLine(); System.out.print(“请输入是否可以租赁:“yesor“no)“); this.yesorno = input.nextLine(); if(“yes“.equals(this.yesorno) System.out.print(“请输入租赁一天的费用元:“); this.money = input.nextInt(); this.days =0; this.result=“no“; this.times =0; public void getback() if(“yes“.equals(
5、this.result) System.out.println(“归还成功“); this.result=“no“; else System.out.println(“您未租赁该设备“); public void getdelete() this.name=null; this.yesorno=null; this.money=0; this.days=0; this.times=0; System.out.print(“删除成功“); public void getlend() if(“yes“.equals(this.yesorno)&“no“.equals(this.result)/no
6、未借出 System.out.print(“请输入借用时间“); this.nowdays = input.nextInt(); System.out.println(“需要费用“+this.nowdaysxthis.money+“元“); this.result=“yes“; this.days=this.days+this.nowdays; this.times+; else System.out.println(“该DVD不允许借出或已经借出“); public int copy() return this.times; public void getlook() System.out.
7、println(“该DVD的名称为“+this.name); if(! “yes“.equals(this.yesorno) System.out.println(“该DVD不能借出“); else System.out.println(“该DVD能借出“); System.out.println(“该DVD借出一天需要“+this.money+“元“); System.out.println(“该DVD的总借出时间为“+this.days+“天“); System.out.println(“该DVD的借出次数为“+this.times+“次“); Override public void a
8、dd() throw new UnsupportedOperationException(“Not supported yet.“); /To change body of generated methods, choose Tools | Templates. Override public void back() throw new UnsupportedOperationException(“Not supported yet.“); /To change body of generated methods, choose Tools | Templates. Override publ
9、ic void delete() throw new UnsupportedOperationException(“Not supported yet.“); /To change body of generated methods, choose Tools | Templates. Override public void lend() throw new UnsupportedOperationException(“Not supported yet.“); /To change body of generated methods, choose Tools | Templates. O
10、verride public void look() throw new UnsupportedOperationException(“Not supported yet.“); /To change body of generated methods, choose Tools | Templates. 2. package dvd; /xx x x author d x/ public interface add void add(); 3. package dvd; /xx x x author d x/ public interface back void back(); 4. pac
11、kage dvd; /xx x x author d x/ public interface delete void delete(); 5. package dvd; /xx x x author d x/ public interface lend void lend(); 6. package dvd; /xx x x author d x/ public interface look void look(); 7. package dvd; import java.util.Scanner; /xx x x author d x/ public class test extends D
12、VD public static void main(Stringargs) String work,panduan=“goon“; int temp,delete=0;/delete计算删除的DVD的个数 Scanner input = new Scanner(System.in); Scanner sc = new Scanner(System.in); System.out.print(“请输入DVD的个数:“); int num = input.nextInt(); DVD dvd= new DVD100; for(int i=0;i100;i+)/对已定义的DVD进行初始化 dvdi=new DVD(“aa“,“bb“,1,1,1,1,“cc“); for(int i=0;inum;i+)/对程序开始时定义的DVD进行增添信息的操作 System.out.printf(“%d“,i+1); dvdi.getadd(); while(“goon“.equals(panduan) System.out.println(“您将要做什么?新增add,查看look,删除delete,借出lend,归还back“); work = sc.