Advertisement
haithienht

JAVA_CD_CDData

Nov 13th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. /**
  2.  *
  3.  * @author Thien
  4.  */
  5. /*
  6.  * To change this license header, choose License Headers in Project Properties.
  7.  * To change this template file, choose Tools | Templates
  8.  * and open the template in the editor.
  9.  */
  10.  
  11. import java.util.Scanner;
  12.  
  13. /**
  14.  *
  15.  * @author Thien
  16.  */
  17. public class CDData {
  18.     Scanner input;
  19.     String colName, CDType, title, id;
  20.     int price, YOR;
  21.    
  22.     public CDData(){
  23.         input = new Scanner(System.in);
  24.         System.out.print("Enter CD ID: ");
  25.         this.id = input.nextLine();
  26.        
  27.         System.out.print("Enter Collection Name(game/movie/music): ");
  28.         this.colName = input.nextLine();
  29.        
  30.         System.out.print("Enter CD Type(audio or video): ");
  31.         this.CDType = input.nextLine();
  32.        
  33.         System.out.print("Enter CD Title: ");
  34.         this.title = input.nextLine();
  35.        
  36.         System.out.print("Enter price: ");
  37.         this.price = input.nextInt();
  38.        
  39.         System.out.print("Enter CD's year of release: ");
  40.         this.YOR = input.nextInt();
  41.        
  42.     }
  43.    
  44.     public String showDetail(){
  45.         return id+"\t"+colName+"\t"+CDType+"\t"+title+"\t"+price+"\t"+YOR;
  46.         //return id+"\t"+title;
  47.     }
  48.    
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement