Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.66 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package baitap;
  7.  
  8. import java.util.ArrayList;
  9. import java.util.Scanner;
  10.  
  11. /**
  12.  *
  13.  * @author t1406g_hctu
  14.  */
  15. public class productManager {
  16.  
  17.     private int Code;
  18.     private String Name;
  19.     private int Price;
  20.  
  21.     public productManager(int Code, String Name, int Price) {
  22.         this.Code = Code;
  23.         this.Name = Name;
  24.         this.Price = Price;
  25.     }
  26.  
  27.     private productManager() {
  28.  
  29.     }
  30.  
  31.     void nhap() {
  32.         Scanner sc = new Scanner(System.in);
  33.         System.out.println("Nhap code: ");
  34.         Code = sc.nextInt();
  35.         System.out.println("Nhap Name: ");
  36.         Name = sc.nextLine();
  37.         System.out.println("Nhap Price: ");
  38.         Price = sc.nextInt();
  39.     }
  40.  
  41.     void xuat() {
  42.         System.out.printf("%-10%-30%-10\n", Code, Name, Price);
  43.     }
  44.  
  45.     int getCode() {
  46.         return Code;
  47.     }
  48.  
  49.     String getName() {
  50.         return Name;
  51.     }
  52.  
  53.     int getPrice() {
  54.         return Price;
  55.     }
  56.  
  57.     class Product {
  58.  
  59.         ArrayList test = new ArrayList();
  60.  
  61.         void inputList() {
  62.             productManager pm = new productManager();
  63.             int dem = 0;
  64.             do {
  65.                 pm.nhap();
  66.                 if (pm.getCode() == 1) {
  67.                     return;
  68.                 }
  69.                 test.add(pm);
  70.                 dem++;
  71.             } while (dem != 4);
  72.         }
  73.     }
  74.  
  75.     public static void main(String[] args) {
  76.         Arraylist al = new Arraylist();
  77.  
  78.         int choice;
  79.         productManager pm = new productManager();
  80.         do {
  81.             System.out.println("APTECHELECTRONIC menu: ");
  82.             System.out.println("1. Enter Products: ");
  83.             System.out.println("2. Display list of products: ");
  84.             System.out.println("3. Search product: ");
  85.             System.out.println("4. Quit: ");
  86.             Scanner sc = new Scanner(System.in);
  87.             choice = sc.nextInt();
  88.             switch (choice) {
  89.                 case 1:
  90.                     System.out.println("Enter: ");
  91.                     break;
  92.                 case 2:
  93.                     System.out.println("Enter: ");
  94.                     break;
  95.                 case 3:
  96.                     System.out.println("Enter: ");
  97.                     break;
  98.                 case 4:
  99.                     System.out.println("Enter: ");
  100.                     return;
  101.                 default:
  102.                     System.out.println("Chon tu 1-4 ");
  103.             }
  104.         } while (choice != 4);
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement