JAVAシロ学習の最初のコード-図書管理システム

7350 ワード

シロは実訓の学習実訓の2週目から図書管理システムのコードを書き始め、次は学習の過程を記録した.LibraryクラスとBooktestクラスを作成Libraryクラス図書管理システムの作成方法を作成し、構築方法を書き込みます.
package com.lenovo.www.entity;

public class Library {

    private int Id;
    private String BookName;
    private String Author;
    private String Reader;
    private String price;
    private String TypeId;
    private String BookDesc;
    public Library() {}


    public Library(int id, String bookName, String author, String reader, String price, String typeId,
            String bookDesc) {
        super();
        Id = id;
        BookName = bookName;
        Author = author;
        Reader = reader;
        this.price = price;
        TypeId = typeId;
        BookDesc = bookDesc;
    }


    public int getId() {
        return Id;
    }
    public void setId(int id) {
        Id = id;
    }
    public String getBookName() {
        return BookName;
    }
    public void setBookName(String bookName) {
        BookName = bookName;
    }
    public String getAuthor() {
        return Author;
    }
    public void setAuthor(String author) {
        Author = author;
    }
    public String getReader() {
        return Reader;
    }
    public void setReader(String reader) {
        Reader = reader;
    }
    public String getPrice() {
        return price;
    }
    public void setPrice(String price) {
        this.price = price;
    }
    public String getTypeId() {
        return TypeId;
    }
    public void setTypeId(String typeId) {
        TypeId = typeId;
    }
    public String getBookDesc() {
        return BookDesc;
    }
    public void setBookDesc(String bookDesc) {
        BookDesc = bookDesc;
    }

}

 ArrayList      ,if  ....else      ,     ,       

package com.lenovo.www.entity; /** * private int id; private String bookName;//図書名private String author;//作者private String reader;//借用者private String price;//図書価格private String TypeId;//図書カテゴリprivate String bookDesc;//コメント*/
import java.awt.print.Book; import java.util.ArrayList; import java.util.Scanner;
public class Booktest { static ArrayList bookList = new ArrayList<>();
public Booktest(int i, String string, String string2, String string3, String string4, String string5,
        String string6) {
    // TODO Auto-generated constructor stub
}

public static void main(String[] args) {
    System.out.println("       ,");
    System.out.println("    ,1");
    System.out.println("    ,2");
    System.out.println("    ,3");
    System.out.println("    ,0");
    Scanner src = new Scanner(System.in);
    if (src.nextInt() == 1) {
        Library s1 = new Library(321, "《   》", "   ", "  ", "30.00 ", "   ", "         ");
        Library s2 = new Library(322, "《   》", "   ", "  ", "35.00 ", "   ", "   ");
        Library s3 = new Library(323, "《   》", "   ", "  ", "36.00 ", "   ", "   ");
        Library s4 = new Library(324, "《   》", "   ", "  ", "37.00 ", "   ", "           ");
        Library s5 = new Library(325, "《    》", "   ", "  ", "40.00 ", "   ", "   ");
        Library s6 = new Library(326, "《   》", "    ", "  ", "35.00 ", "   ", "   ");

        bookList.add(s1);
        bookList.add(s2);
        bookList.add(s3);
        bookList.add(s4);
        bookList.add(s5);
        bookList.add(s6);
        for (int i = 0; i < bookList.size(); i++) {

            Library a = bookList.get(i);

            System.out.println("     : " + a.getId() + "      : " + a.getBookName() + "    : " + a.getAuthor()
                    + "          : " + a.getReader() + "     : " + a.getPrice() + "      :" + a.getTypeId()
                    + "   :  " + a.getBookDesc());
        }
    } else  {



        System.exit(0);
    }

}

}

Library s 1=new Library(321、「白鹿原」、「陳忠実」、「明ちゃん」、「30.00元」、「文学類」、「貸し出し人数が多い」)、Library s 2=new Library(322、「西遊記」、「呉承恩」、「紅ちゃん」、「35.00元」、「文学類」、「);Library s 3=new Library(323、「紅楼夢」、「曹雪芹」、「小白」、「36.00元」、「文学類」、「);Library s 4=new Library(324、「水滸伝」、「施耐庵」、「小黒」、「37.00元」、「文学類」、「指定日までに返却されていない」)、Library s 5=new Library(325、「三国演義」、「羅貫中」、「小明」、「40.00元」、「文学類」、「);Library s 6=new Library(326,『白夜行』,『東野圭吾』,『小藍』,『35.00元』,『サスペンス類』,』);
****     Library    booklist**

   int       0501     int    

private int id;
Library s2 = new Library(322, "《   》", "   ", "  ", "35.00 ", "   ", "   ");
    Library s2 = new Library(0501, "《   》", "   ", "  ", "35.00 ", "   ", "   ");(   ) 

“`