Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package baitap;
- import java.util.ArrayList;
- import java.util.Scanner;
- /**
- *
- * @author t1406g_hctu
- */
- public class productManager {
- private int Code;
- private String Name;
- private int Price;
- public productManager(int Code, String Name, int Price) {
- this.Code = Code;
- this.Name = Name;
- this.Price = Price;
- }
- private productManager() {
- }
- void nhap() {
- Scanner sc = new Scanner(System.in);
- System.out.println("Nhap code: ");
- Code = sc.nextInt();
- System.out.println("Nhap Name: ");
- Name = sc.nextLine();
- System.out.println("Nhap Price: ");
- Price = sc.nextInt();
- }
- void xuat() {
- System.out.printf("%-10%-30%-10\n", Code, Name, Price);
- }
- int getCode() {
- return Code;
- }
- String getName() {
- return Name;
- }
- int getPrice() {
- return Price;
- }
- class Product {
- ArrayList test = new ArrayList();
- void inputList() {
- productManager pm = new productManager();
- int dem = 0;
- do {
- pm.nhap();
- if (pm.getCode() == 1) {
- return;
- }
- test.add(pm);
- dem++;
- } while (dem != 4);
- }
- }
- public static void main(String[] args) {
- Arraylist al = new Arraylist();
- int choice;
- productManager pm = new productManager();
- do {
- System.out.println("APTECHELECTRONIC menu: ");
- System.out.println("1. Enter Products: ");
- System.out.println("2. Display list of products: ");
- System.out.println("3. Search product: ");
- System.out.println("4. Quit: ");
- Scanner sc = new Scanner(System.in);
- choice = sc.nextInt();
- switch (choice) {
- case 1:
- System.out.println("Enter: ");
- break;
- case 2:
- System.out.println("Enter: ");
- break;
- case 3:
- System.out.println("Enter: ");
- break;
- case 4:
- System.out.println("Enter: ");
- return;
- default:
- System.out.println("Chon tu 1-4 ");
- }
- } while (choice != 4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement