PackageDvdpackage;ImportJava.util.Scanner; Public classMain { Public Static voidMain (string[] args) {//TODO auto-generated Method Stub intbt1; Scanner input=NewScanner (system.in); Do{System.out.println ("??? Welcome to use the Mini DVD management system??); System.out.println ("------------------"); System.out.println ("? 1. New DVD"); System.out.println ("? 2. View DVD"); System.out.println ("? 3. Delete DVD"); System.out.println ("? 4. Lend a DVD"); System.out.println ("? 5. Return DVD"); System.out.println ("? 6. Exit DVD Management System"); System.out.println ("-------------------"); System.out.println ("Please select the function!" "); BT1=Input.nextint (); Switch(BT1) { Case1:system.out.println ("New DVD"); System.out.println ("Please enter movie name"); Input.next (); Do{SYSTEM.OUT.PRINTLN ("new completed, press 0 to return"); bt1 =input.nextint ();} while(bt1!=0); Break; Case2:system.out.println ("View DVD"); System.out.println ("Please enter the name of the movie you want to see"); Input.next (); Do{System.out.println ("view done, press 0 to return"); bt1 =input.nextint ();} while(bt1!=0); Break; Case3:system.out.println ("Delete DVD"); System.out.println ("Enter the name of the movie you want to delete"); Input.next (); Do{System.out.println ("delete complete, press 0 to return"); bt1 =input.nextint ();} while(bt1!=0); Break; Case4:system.out.println ("Lend a DVD"); System.out.println ("Enter the name of the borrowed movie"); Input.next (); Do{System.out.println ("View loan complete, press 0 to return"); bt1 =input.nextint ();} while(bt1!=0); Break; Case5:system.out.println ("Return DVD"); System.out.println ("Enter the name of the returned movie"); Input.next (); Do{System.out.println ("return completed, press 0"); bt1 =input.nextint ();} while(bt1!=0); Break; Case6:system.out.println ("Exit DVD"); System.out.println ("Do you really want to quit?"); return; default: System.out.println ("Input error, re-enter"); Break; }} while(true); }}
Java Fundamentals 4