文章目录

  • 1.玩家选择角色:return new
  • 2.人工挑苹果:只一个接口CompareAble
  • 3.员工类接口:implements Comparator
  • 4. 医生帮换心脏:Organ类doWork方法,内部类,Doctor类swapHeart方法
  • 5.斗地主:双重for,Collections.shuffle,list.get(i)
  • 6.发工资:数组元素和,逢七必过,随机数
  • 7.客户信息管理软件
    • 7.1 介绍:类中函数实现数组增删改查
    • 7.2 M:super()
    • 7.3 V:switch,调C层中函数
    • 7.4 C:System.arraycopy
    • 7.5 main函数:CustomerView
  • 8.开发团队调度系统
    • 8.1 介绍:enum,给定数据就是Data.java需装成一个个对象为公司员工
    • 8.2 M:3人,3物,1状态
      • 8.2.1 员工和队员:Status
      • 8.2.2 设备:Equipment
    • 8.3 V:调用C
    • 8.4 C:init初始化数组
    • 8.5 main函数:TeamView
    • 8.6 工具:异常,数据,TSUtility

1.玩家选择角色:return new

package com.atguigu.homework.test03;
import java.util.Scanner;
/*
* 1.定义接口FightAble:抽象方法:specialFight。默认方法:commonFight,方法中打印"普通打击"。* 2.定义战士类:实现FightAble接口,重写方法中打印"武器攻击"。* 3.定义法师类Mage:实现FightAble接口,重写方法中打印"法术攻击"。* 4.定义玩家类Player:静态方法:FightAble select(String str),根据指令选择角色。法力角色,选择法师。武力角色,选择战士。
*/
public class Test03 {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.print("选择:");String role = input.next();  FightAble f = Player.select(role); //Player.select(role)返回new Mage(),Mage类里重写了specialFight()方法f.specialFight();f.commonFight();}
}//1111111111111111111111111111111111111111111111111111111111111111111111
interface FightAble{void specialFight();public default void commonFight(){System.out.println("普通打击");}
}
class Soldier implements FightAble{@Overridepublic void specialFight() {System.out.println("武器攻击");}
}
class Mage implements FightAble{@Overridepublic void specialFight() {System.out.println("法术攻击");}
}class Player{public static FightAble select(String str){if("法力角色".equals(str)){return new Mage(); //com.itheima.demo01.Mage@610455d6}else if("武力角色".equals(str)){return new Soldier();}return null; //函数不是void要有返回值}
}

2.人工挑苹果:只一个接口CompareAble

package com.atguigu.homework.test04;public class Apple {private double size;private String color;public Apple(double size, String color) {super();this.size = size;this.color = color;}public Apple() {super();}public double getSize() {return size;}public void setSize(double size) {this.size = size;}public String getColor() {return color;}public void setColor(String color) {this.color = color;}@Overridepublic String toString() {return size + "-" + color;}
}
package com.atguigu.homework.test04;public interface CompareAble {//定义默认方法compare,挑选较大苹果。public default void compare(Apple a1, Apple a2){if(a1.getSize() > a2.getSize()){System.out.println(a1);}else{System.out.println(a2); }}
}
package com.atguigu.homework.test04;public class CompareBig implements CompareAble{//CompareAble接口有默认方法就是挑较大苹果
}
package com.atguigu.homework.test04;public class CompareColor implements CompareAble{ //挑红色public void compare(Apple a1, Apple a2){if("红色".equals(a1.getColor())){System.out.println(a1);}if("红色".equals(a2.getColor())){System.out.println(a2);}}
}
package com.atguigu.homework.test04;public class Worker { //工人类挑选苹果public void pickApple(CompareAble c,Apple a1,Apple a2){c.compare(a1, a2);}
}
package com.atguigu.homework.test04;public class Test04 {public static void main(String[] args) {        Apple a1 = new Apple(5.0, "青色");Apple a2 = new Apple(3.0, "红色");Worker w = new Worker();CompareBig cb = new CompareBig();w.pickApple(cb, a1, a2); //工人挑大苹果CompareColor cc = new CompareColor();w.pickApple(cc, a1, a2); //工人挑红苹果}
}


将上面改为匿名内部类实现接口来代替CompareBig和CompareColor就不用单独写两个实现类了。自己定义的,不是able to。如下第一行就是比较大小。

3.员工类接口:implements Comparator

package com.atguigu.test06.exer;
/*
(1)声明一个员工类Employee,有属性:编号、姓名、年龄、薪资
(2)让Employee员工类实现java.lang.Comparable接口,重写抽象方法,按照编号从小到大排序
*/
public class Employee implements Comparable{    private int id;private String name;private int age;private double salary;public Employee(int id, String name, int age, double salary) {super();this.id = id;this.name = name;this.age = age;this.salary = salary;}public Employee() {super();}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public double getSalary() {return salary;}public void setSalary(double salary) {this.salary = salary;}@Overridepublic String toString() {return "Employee [id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + "]";}    //重写抽象方法,按照编号从小到大排序@Overridepublic int compareTo(Object o) {return this.id - ((Employee)o).id;}
}
package com.atguigu.test06.exer;
import java.util.Comparator;
/** (4)声明SalaryComparator类,实现java.util.Comparator接口,重写抽象方法,按照薪资从高到低排序*/
public class SalaryComparator implements Comparator {@Overridepublic int compare(Object o1, Object o2) {Employee e1 = (Employee) o1;Employee e2 = (Employee) o2;     if(e1.getSalary() > e2.getSalary()){return -1;}else if(e1.getSalary() < e2.getSalary()){return 1;}return 0;}
}
package com.atguigu.test06.exer;
import java.util.Arrays;
/*
(3)在测试类中创建Employee[]数组,调用java.util.Arrays的sort方法进行排序,遍历结果。用SalaryComparator对象重新对Employee[]数组进行排序,遍历结果。
*/
public class TestExer2 {public static void main(String[] args) {Employee[] all = new Employee[3];all[0] = new Employee(2, "王小二", 22, 20000);all[1] = new Employee(3, "张三", 23, 13000);all[2] = new Employee(1, "李四", 24, 8000);//调用java.util.Arrays的sort方法进行排序,遍历结果Arrays.sort(all);       for (int i = 0; i < all.length; i++) { //按编号id从小到大排序System.out.println(all[i]);}System.out.println("-----------------------------");//再次调用java.util.Arrays的sort方法进行排序,遍历结果Arrays.sort(all, new SalaryComparator());for (int i = 0; i < all.length; i++) {System.out.println(all[i]);}}
}

4. 医生帮换心脏:Organ类doWork方法,内部类,Doctor类swapHeart方法


package com.atguigu.test06;public abstract class Organ {  //器官类型public abstract void doWork();
}
package com.atguigu.test06;
import java.util.Random;public class Body {private String owner;private double weight; //克private boolean health;private Organ heart;   public Body(String owner, double weight, boolean health) {super();this.owner = owner;this.weight = weight;this.health = health;  //如下heart在有参构造中根据身体Body状况创建心脏对象,new Heart()不传参,无参构造。Heart heart =  new Heart();heart.size = weight * 0.005;Random rand = new Random();if(health){heart.color = "鲜红色";//rand.nextInt(41)==>[0,41),[0,40]  heart.beatPerMinute = rand.nextInt(41) + 60;  //60-100}else{heart.color = "暗红色";//[0,60) 或 [101,~)heart.beatPerMinute  = rand.nextInt(60);}     this.heart = heart;  //此时才创建}//1111111111111111111111111111111111111111111111111111111111111111111111111111            private class Heart extends Organ{int beatPerMinute;//每分钟跳动次数String color;double size;      @Overridepublic void doWork() {System.out.println("心率:" + beatPerMinute + ",大小:" + size + ",颜色:" + color);//如下owner属性是创建Heart对象的那个Body对象,Body.this指Body这类的成员变量,不是外部传入
//          System.out.println("为血液流动提供动力,把血液运行至" + owner + "身体各个部分");System.out.println("为血液流动提供动力,把血液运行至" + Body.this.owner + "身体各个部分");}}public String getOwner() {return owner;}public void setOwner(String owner) {this.owner = owner;}public double getWeight() {return weight;}public void setWeight(double weight) {this.weight = weight;}public boolean isHealth() {return health;}public void setHealth(boolean health) {this.health = health;}public Organ getHeart() {return heart;}public void setHeart(Organ heart) {this.heart = heart;}@Overridepublic String toString() {return "姓名:" + owner + ", 体重:" + weight + ",健康与否:" + health;}
}
package com.atguigu.test06;public class Doctor {public void swapHeart(Body b1, Body b2){Organ temp = b1.getHeart();b1.setHeart(b2.getHeart()); //b1心脏为b2b2.setHeart(temp);  //b2心脏为b1boolean hTemp = b1.isHealth();b1.setHealth(b2.isHealth());  //b1健康为b2b2.setHealth(hTemp);  //b2心脏为b1}
}
package com.atguigu.test06;public class TestExer06 {public static void main(String[] args) {Body b1 = new Body("张三", 50000, true);Body b2 = new Body("李四",100000,false);               System.out.println(b1); //姓名 ,体重 ,健康      b1.getHeart().doWork();    //心率 ,为血液         System.out.println(b2); //姓名 ,体重 ,健康      b2.getHeart().doWork();    //心率 ,为血液  System.out.println("============================");  Doctor d = new Doctor();d.swapHeart(b1, b2);   System.out.println(b1); //姓名 ,体重 ,健康b1.getHeart().doWork();       //心率 ,为血液            System.out.println(b2); //姓名 ,体重 ,健康b2.getHeart().doWork();    //心率 ,为血液}
}

如下注意粉色就行。

5.斗地主:双重for,Collections.shuffle,list.get(i)

package com.itheima00.poker;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;public class PokerDemo {public static void main(String[] args) {//1. 准备一副牌String[] colors = {"♠","♥","♣","♦"};String[] numbers = {"3","4","5","6","7","8","9","10","J","Q","K","A","2"};ArrayList<String> list = new ArrayList<>(); //集合收集牌for (String color : colors) {for (String number : numbers) {String poker = color + number;
//                System.out.println(poker);list.add(poker);}}list.add("小☺");list.add("大☺");//System.out.println(list);//2. 洗牌: 随机产生次数10 , 再随机交换两个元素位置Collections.shuffle(list); // Arrays / Collections / Objects 工具类 : 静态方法//System.out.println(list);//3. 发牌:模拟三个玩家+底牌ArrayList<String> p1 = new ArrayList<>();ArrayList<String> p2 = new ArrayList<>();ArrayList<String> p3 = new ArrayList<>();ArrayList<String> dp = new ArrayList<>();for (int i = 0; i < list.size(); i++) { //遍历这副牌,不能用增强for循环,因为增强for循环无索引。第0张发给谁,要用索引取模。所以用普通for循环。   String poker = list.get(i); //取当前牌,第一次取就是第0张牌int mod = i % 3;if(i < 3){ //先发三张底牌,不然最后会忘记留底牌dp.add(poker);}else if(mod == 0){p1.add(poker);}else if(mod == 1){p2.add(poker);}else if(mod == 2){p3.add(poker);}}//4.看牌lookPoker(p1); lookPoker(p2);lookPoker(p3);lookPoker(dp);}private static void lookPoker(ArrayList<String> list) {Iterator<String> it = list.iterator();while(it.hasNext()){String poker = it.next();System.out.print(poker+"\t"); //同一个人不换行打印}System.out.println(); //不同人换行}
}

6.发工资:数组元素和,逢七必过,随机数

员工,生日,两类员工。

package com.atguigu.test03.exer;public abstract class Employee {private String name;private MyDate birthday;public Employee(String name, MyDate birthday) {super();this.name = name;this.birthday = birthday;}public Employee() {super();}public Employee(String name,int year, int month, int day){super();this.name = name;this.birthday = new MyDate(year, month ,day);}public String getName() {return name;}public void setName(String name) {this.name = name;}public MyDate getBirthday() {return birthday;}public void setBirthday(MyDate birthday) {this.birthday = birthday;}//double earnings()public abstract double earnings(); //抽象方法没有方法体不能加{}public String toString(){  //toString()方法输出对象的name,birthday。return "姓名:" + name + ",生日:" + birthday.toDateString();}
}
package com.atguigu.test03.exer;public class MyDate {private int year;private int month;private int day;public MyDate(int year, int month, int day) {super();this.year = year;this.month = month;this.day = day;}public MyDate() {super();}public int getYear() {return year;}public void setYear(int year) {this.year = year;}public int getMonth() {return month;}public void setMonth(int month) {this.month = month;}public int getDay() {return day;}public void setDay(int day) {this.day = day;}        public String toDateString(){  //toDateString()方法返回日期对应的字符串:xxxx年xx月xx日return year + "年" + month + "月" + day + "日";}
}
package com.atguigu.test03.exer;public class SalariedEmployee extends Employee{private double monthlySalary;private int workingDay;private int totalDays;public SalariedEmployee(String name, MyDate birthday, double monthlySalary, int workingDay, int totalDays) {super(name, birthday);this.monthlySalary = monthlySalary;this.workingDay = workingDay; this.totalDays = totalDays; }public SalariedEmployee(String name, int year, int month, int day, double monthlySalary, int workingDay, int totalDays) {super(name, year, month, day);this.monthlySalary = monthlySalary;this.workingDay = workingDay;this.totalDays = totalDays;}public SalariedEmployee() {super();}public double getMonthlySalary() {return monthlySalary;}public void setMonthlySalary(double monthlySalary) {this.monthlySalary = monthlySalary;}public int getWorkingDay() {return workingDay;}public void setWorkingDay(int workingDay) {this.workingDay = workingDay;}public int getTotalDays() {return totalDays;}public void setTotalDays(int totalDays) {this.totalDays = totalDays;}@Overridepublic double earnings() {  //实现父类的抽象方法earnings(),该方法返回月薪*出勤天数/本月总工作日;return monthlySalary * workingDay / totalDays;}public String toString(){  //toString()方法输出员工类型信息及员工的name,birthday。return "正式工:" + super.toString();}
}
package com.atguigu.test03.exer;public class HourlyEmployee extends Employee{private int wage;private int hour;public HourlyEmployee() {super();}public HourlyEmployee(String name, MyDate birthday, int wage, int hour) {super(name, birthday);this.wage = wage;this.hour = hour;}public HourlyEmployee(String name, int year, int month, int day, int wage, int hour) {super(name, year, month, day);this.wage = wage;this.hour = hour;}public int getWage() {return wage;}public void setWage(int wage) {this.wage = wage;}public int getHour() {return hour;}public void setHour(int hour) {this.hour = hour;}@Overridepublic double earnings() { //实现父类的抽象方法earnings(),该方法返回wage*hour值;return wage * hour;}public String toString(){  //toString()方法输出员工类型信息及员工的name,birthday。return "小时工: " + super.toString();}
}
package com.atguigu.test03.exer;
import java.util.Scanner;public class TestExer2 {public static void main(String[] args) {Employee[] all = new Employee[2];all[0] = new SalariedEmployee("杨洪强", 1995, 12, 14, 25000, 20, 23);all[1] = new HourlyEmployee("崔志恒", new MyDate(1993, 3, 8), 50, 100);Scanner input = new Scanner(System.in);System.out.print("请输入月份:");int month = input.nextInt();    for (int i = 0; i < all.length; i++) {if(all[i].getBirthday().getMonth() == month){System.out.println(all[i].toString() + ",实发工资:" +( all[i].earnings()+100));}else{System.out.println(all[i].toString() + ",实发工资:" +all[i].earnings());}}     }
}



public class Test06 {public static void main(String[] args) {//定义一个数组,用静态初始化完成数组元素的初始化int[] arr = {68, 27, 95, 88, 171, 996, 51, 210};//定义一个求和变量,初始值是0int sum = 0;//遍历数组,获取到数组中的每一个元素for(int x=0; x<arr.length; x++) {//判断该元素是否满足条件,如果满足条件就累加if(arr[x]%10!=7 && arr[x]/10%10!=7 && arr[x]%2==0) {sum += arr[x];}}System.out.println("sum:" + sum); //1362}
}

public class Test03 {public static void main(String[] args) {//数据在1-100之间,用for循环实现数据的获取for(int x=1; x<=100; x++) {//根据规则,用if语句实现数据的判断:要么个位是7,要么十位是7,要么能够被7整除if(x%10==7 || x/10%10==7 ) {//在控制台输出满足规则的数据System.out.println(x);}}}
}
import java.util.Random;
class Demo01_Random {public static void main(String[] args) {//创建键盘录入数据的对象Random r = new Random();//随机生成一个数据int number = r.nextInt(33)+1; //0-33间再+1即1-34间System.out.println("number:"+ number);}
}

7.客户信息管理软件

7.1 介绍:类中函数实现数组增删改查

v:客户端,c:服务端。


如下代码写到view文件夹里。

Customer对象(每个客户信息的保存)也就是Javabean实体类,用数组存放Customer对象实现增删改(修改Customer对象再替换数组中)查。

如下括号里如张三是原来的信息。



CM…java在utils包里,见文章:https://blog.csdn.net/weixin_43435675/article/details/107279257。

下面View调用Service里方法。

7.2 M:super()

(Test.java先运行main方法)CustomerView.java - Customer.java - CustomerService.java

package com.atguigu.bean;public class Customer {private String name;  // 客户姓名private char gender;  // 性别private int age;  // 年龄private String phone; // 电话号码private String email; // 电子邮箱public Customer() {super();}public Customer(String name, char gender, int age, String phone, String email) {super();this.name = name;this.gender = gender;this.age = age;this.phone = phone;this.email = email;}public String getName() {return name;}public void setName(String name) {this.name = name;}public char getGender() {return gender;}public void setGender(char gender) {this.gender = gender;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public String getPhone() {return phone;}public void setPhone(String phone) {this.phone = phone;}public String getEmail() {return email;}public void setEmail(String email) {this.email = email;}    public String getInfo(){return name + "\t" + gender +"\t"+ age + "\t" + phone + "\t" + email;}
}

7.3 V:switch,调C层中函数

package com.atguigu.view;
import com.atguigu.bean.Customer;
import com.atguigu.service.CustomerService;
import com.atguigu.utils.CMUtility;public class CustomerView {private CustomerService cs = new CustomerService();  public void menu(){while(true){System.out.println("-----------------客户信息管理软件-----------------");  System.out.println("\t\t1 添 加 客 户");System.out.println("\t\t2 修 改 客 户");System.out.println("\t\t3 删 除 客 户");System.out.println("\t\t4 客 户 列 表");System.out.println("\t\t5 退           出");    System.out.print("请选择(1-5):");char select = CMUtility.readMenuSelection();switch(select){case '1':add();break;case '2':update();break;    case '3':delete();break;case '4':list();break;case '5':System.out.println("确定退出吗?Y/N");char confirm = CMUtility.readConfirmSelection();if(confirm == 'Y'){return;}}}}//111111111111111111111111111111111111111111111111111111111111111111111111111111111 private void list() {//(1)调用CustomerService类的getAll方法获取已经存储的所有客户对象Customer[] all = cs.getAll(); //(2)遍历显示System.out.println("---------------------------客户列表---------------------------");System.out.println("编号\t姓名\t性别\t年龄\t电话\t邮箱");for (int i = 0; i < all.length; i++) {           System.out.println( (i+1) + "\t" +all[i].getInfo()); //打印客户对象的信息}System.out.println("-------------------------客户列表完成-------------------------");}//111111111111111111111111111111111111111111111111111111111111111111111111111111111111 private void delete() {System.out.println("---------------------删除客户---------------------");System.out.print("请选择待删除客户编号(-1退出):");int id = CMUtility.readInt(); //用户输入   if(id == -1){//如果是-1就结束return;}   System.out.print("确认是否删除(Y/N):");char confirm = CMUtility.readConfirmSelection();if(confirm == 'N'){//如果不删除,就结束return;}    //调用CustomerService类的removeById(int id)删除cs.removeById(id);System.out.println("---------------------删除完成---------------------");}//11111111111111111111111111111111111111111111111111111111111111111111111111111111 private void update() {System.out.println("---------------------修改客户---------------------");System.out.print("请选择待修改客户编号(-1退出):");int id = CMUtility.readInt();       if(id == -1){//-1退出return;}       //调用CustomerSerivce的getById(id)获取该客户对象的原来即old的信息Customer old = cs.getById(id);//输入新的数据System.out.print("姓名(" + old.getName() + "):");//如果用户直接输入回车,没有输入新的姓名,那么就用old.getName()代替,即保持不变String name = CMUtility.readString(20, old.getName());System.out.print("性别(" + old.getGender() +"):");char gender = CMUtility.readChar(old.getGender());System.out.print("年龄(" + old.getAge() +"):");int age = CMUtility.readInt(old.getAge());System.out.print("电话(" + old.getPhone() +"):");String phone = CMUtility.readString(11, old.getPhone());System.out.print("邮箱(" + old.getEmail() +"):");String email = CMUtility.readString(32, old.getEmail());//创建一个新的客户对象Customer newCustomer = new Customer(name, gender, age, phone, email);//替换数组中原来的客户对象 //调用CustomerService的replace(id,newCustomer)cs.replace(id, newCustomer);       System.out.println("---------------------修改完成---------------------");     }//11111111111111111111111111111111111111111111111111111111111111111111111111111111private void add() {System.out.println("---------------------添加客户---------------------");//(1)键盘输入客户信息System.out.print("姓名:");String name = CMUtility.readString(20);System.out.print("性别:");char gender = CMUtility.readChar();
//      char gender  = CMUtility.readChar('男');//如果用户不输入,用'男'代替System.out.print("年龄:");int age = CMUtility.readInt();System.out.print("电话:");String phone = CMUtility.readString(11);System.out.print("邮箱:");String email = CMUtility.readString(32);//(2)创建Customer对象Customer c = new Customer(name, gender, age, phone, email);//(3)调用CustomerService的//addCustomer(Customer c)
//      CustomerService cs = new CustomerService();//不应该是局部变量cs.addCustomer(c);        System.out.println("---------------------添加完成---------------------");}
}

7.4 C:System.arraycopy

package com.atguigu.service;
import java.util.Arrays;
import com.atguigu.bean.Customer;public class CustomerService {private Customer[] all ;//用来存储客户对象private int total;//记录实际存储的客户的数量   public CustomerService(){all = new Customer[2];}public CustomerService(int initSize){all = new Customer[initSize];}   //11111111111111111111111111111111111111111111111.添加一个客户对象到当前的数组中public void addCustomer(Customer c){//(1)数组是否已满if(total >= all.length){System.out.println("数组已满");return;}       //(2)把c存储all数组中all[total++] = c;}    //1111111111111111111111111111111111111111111111112.返回所有已经存储的客户对象public Customer[] getAll(){//      return all;//如果返回all,里面可能有空null。返回total长度的all对象数组
/*      Customer[] result = new Customer[total];for (int i = 0; i < total; i++) {result[i] = all[i];}return result;*/           //下面一行=上面  return Arrays.copyOf(all, total);//复制一个新数组all,长度为total}//1111111111111111111111111111111111111111113.根据客户的编号进行删除客户对象的操作public void removeById(int id){//(1)确定下标int index = id-1;      //(2)检查下标的合理性if(index<0 || index>=total){System.out.println(id + "对应的客户不存在");//以后这个可以抛异常解决return;}      //(3)把[index]后面的元素往前移动/** 假设:total = 5* index = 1  移动all[2]->all[1], all[3]-->all[2],all[4]-->all[3]* 移动3个    length = total - index - 1;*/ //把all的index+1移动到all的indexSystem.arraycopy(all, index+1, all, index, total-index-1);//       //(4)把最后一个置为null
//      all[total-1] = null;//     //(5)人数减少
//      total--;        all[--total] = null; //结合(4)(5)}//111111111111111111111111111111111111111111111114.根据客户编号查询一个客户对象的方法public Customer getById(int id){//(1)确定下标int index = id -1;       //(2)考虑下标的合理性if(index<0 || index>=total){System.out.println(id+"客户不存在");return null; //因为getById不是void,所以要写null}       //(3)返回[index]位置的客户对象return all[index];}//111111111111111111111111111111111111111115.根据客户编号,替换原来的客户对象public void replace(int id, Customer newCustomer){//(1)先确定index下标int index = id -1;      //(2)检查下标if(index<0 || index>=total){System.out.println(id + "客户不存在");return;}        //(3)替换all[index] = newCustomer;}
}

7.5 main函数:CustomerView

package com.atguigu.test;
import com.atguigu.view.CustomerView;public class Test {public static void main(String[] args) {CustomerView view = new CustomerView();view.menu();}
}

8.开发团队调度系统

8.1 介绍:enum,给定数据就是Data.java需装成一个个对象为公司员工

普通员工不要,判断是不是架构师,设计师,程序员用instance of判断对象类型。

增:不能添加就抛异常。


删:删除成功后按回车键重新现实主界面。

查:先择1。



如下员工类型分析,javabean来自于Data.java。

如下员工数量分析,Employee是父类,length是行数。

如下设备分析。


8.2 M:3人,3物,1状态

8.2.1 员工和队员:Status

package com.atguigu.bean;public class Employee {private int id;private String name;private int age;private double salary;public Employee(int id, String name, int age, double salary) {super();this.id = id;this.name = name;this.age = age;this.salary = salary;}public Employee() {super();}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public double getSalary() {return salary;}public void setSalary(double salary) {this.salary = salary;}@Overridepublic String toString() {return getBasicInfo();}protected String getBasicInfo() {return id + "\t" + name + "\t" + age + "\t" + salary;}
}
package com.atguigu.bean;public class Programmer extends Employee { //Programmer程序员private int memberId; //团队编号     在加入到团队时,才开始分配,不是创建对象时分配private Status status = Status.FREE;  //Status.javaprivate Equipment equipment;public Programmer() {super();}public Programmer(int id, String name, int age, double salary, int memberId, Status status, Equipment equipment) { //全的super(id, name, age, salary);this.memberId = memberId;this.status = status;this.equipment = equipment;}public Programmer(int id, String name, int age, double salary, Equipment equipment) { //Date.java中可看到super(id, name, age, salary);this.equipment = equipment;}public int getMemberId() {return memberId;}public void setMemberId(int memberId) {this.memberId = memberId;}public Status getStatus() {return status;}public void setStatus(Status status) {this.status = status;}public Equipment getEquipment() {return equipment;}public void setEquipment(Equipment equipment) {this.equipment = equipment;}@Overridepublic String toString() {//没有奖金和股票return getBasicInfo()  +"\t程序员\t" + status + "\t\t\t" + equipment;}public String getMemberInfo(){return memberId + "/" + getBasicInfo() +"\t程序员";}
}
package com.atguigu.bean;public class Designer extends Programmer{private double bonus;public Designer() {super();}public Designer(int id, String name, int age, double salary, Equipment equipment, double bonus) {super(id, name, age, salary, equipment);this.bonus = bonus;}public Designer(int id, String name, int age, double salary, int memberId, Status status, Equipment equipment, double bonus) {super(id, name, age, salary, memberId, status, equipment);this.bonus = bonus;}public double getBonus() {return bonus;}public void setBonus(double bonus) {this.bonus = bonus;}  @Overridepublic String toString() { //没有股票return getBasicInfo() + "\t设计师\t" + getStatus() + "\t" + bonus +"\t\t" + getEquipment();}    public String getMemberInfo(){return getMemberId() + "/" + getBasicInfo() +"\t设计师\t" + bonus;}
}
package com.atguigu.bean;public class Architect extends Designer{private int stock;public Architect() {super();}public Architect(int id, String name, int age, double salary, Equipment equipment, double bonus, int stock) {super(id, name, age, salary, equipment, bonus);this.stock = stock;}public Architect(int id, String name, int age, double salary, int memberId, Status status, Equipment equipment, double bonus, int stock) {super(id, name, age, salary, memberId, status, equipment, bonus);this.stock = stock;}public int getStock() {return stock;}public void setStock(int stock) {this.stock = stock;}@Overridepublic String toString() {return getBasicInfo() + "\t架构师\t" + getStatus() + "\t" + getBonus() +"\t" +stock+ "\t" + getEquipment();}public String getMemberInfo(){return getMemberId() + "/" + getBasicInfo() +"\t架构师\t" + getBonus() + "\t" + stock;}
}
package com.atguigu.bean;public enum Status {BUSY,FREE,VOCATION  //枚举:忙,空闲,假期
}

8.2.2 设备:Equipment

package com.atguigu.bean;public interface Equipment {String getDescription();
}
package com.atguigu.bean;public class PC implements Equipment{private String model;private String display;public PC(String model, String display) {super();this.model = model;this.display = display;}public PC() {super();}public String getModel() {return model;}public void setModel(String model) {this.model = model;}public String getDisplay() {return display;}public void setDisplay(String display) {this.display = display;}@Overridepublic String toString() {return getDescription();}@Overridepublic String getDescription() {return model + "(" + display + ")" ; // 戴尔(NEC17寸)  //model指品牌}
}
package com.atguigu.bean;public class NoteBook implements Equipment{private String model;private double price;public NoteBook(String model, double price) {super();this.model = model;this.price = price;}public NoteBook() {super();}public String getModel() {return model;}public void setModel(String model) {this.model = model;}public double getPrice() {return price;}public void setPrice(double price) {this.price = price;}@Overridepublic String toString() {return getDescription();}@Overridepublic String getDescription() {return model + "(" + price + ")"; // 联想T4(6000.0)}
}
package com.atguigu.bean;public class Printer implements Equipment{private String type;private String name;public Printer(String type, String name) {super();this.type = type;this.name = name;}public Printer() {super();}public String getType() {return type;}public void setType(String type) {this.type = type;}public String getName() {return name;}public void setName(String name) {this.name = name;}@Overridepublic String toString() {return getDescription();}@Overridepublic String getDescription() {   return name + "(" + type + ")"; //佳能 2900(激光)}
}

8.3 V:调用C

package com.atguigu.view;
import com.atguigu.bean.Employee;
import com.atguigu.bean.Programmer;
import com.atguigu.exception.TeamException;
import com.atguigu.service.NameListService;
import com.atguigu.service.TeamService;
import com.atguigu.utils.TSUtility;public class TeamView {private NameListService ns = new NameListService();private TeamService ts = new TeamService();  public void menu(){System.out.println("-------------------------------------开发团队调度软件--------------------------------------");getAllEmployee();        while(true){System.out.println("---------------------------------------------------------------------------------------------------");System.out.print("1-团队列表  2-添加团队成员  3-删除团队成员 4-退出   请选择(1-4):");char select = TSUtility.readMenuSelection();switch(select){case '1':list();break;case '2':getAllEmployee();add();break;case '3':list();remove();break;case '4':System.out.print("确认是否退出(Y/N):");char confirm = TSUtility.readConfirmSelection();if(confirm == 'Y'){return;}}}} //111111111111111111111111111111111111111111111111111111111111111111111111111111111 private void remove() {System.out.println("---------------------删除成员---------------------");System.out.print("请输入要删除员工的TID:"); //(1)输入要删除的团队成员的团队编号int tid = TSUtility.readInt();   System.out.print("确认是否删除(Y/N):"); //(2)确认是否删除char confirm = TSUtility.readConfirmSelection();if(confirm == 'N'){System.out.println("删除取消!");return;//提前结束删除}        try {ts.removeMemberByTid(tid); //(3)删除,调用TeamService的removeMemberByTid删除System.out.println("删除成功!");} catch (TeamException e) {System.out.println("删除失败,原因:" + e.getMessage());}      TSUtility.readReturn();}//11111111111111111111111111111111111111111111111111111111111111111111111111111111111   private void add() {System.out.println("---------------------添加成员---------------------");System.out.print("请输入要添加的员工ID:"); //(1)输入编号int id = TSUtility.readInt();       try {  Employee emp = ns.getEmployeeById(id);  //(2)根据编号获取员工对象                 ts.addMember(emp);   //(3)添加到团队中        System.out.println("添加成功");} catch (TeamException e) {System.out.println("添加失败,原因:" + e.getMessage());}      TSUtility.readReturn();}//111111111111111111111111111111111111111111111111111111111111111111111111111   private void list() {System.out.println("--------------------团队成员列表---------------------");System.out.println("TID/ID\t姓名\t年龄\t工资\t职位\t奖金\t股票");Programmer[] allMembers = ts.getAllMembers();for (int i = 0; i < allMembers.length; i++) {//          System.out.println(allMembers[i]);//自动调用toString()System.out.println(allMembers[i].getMemberInfo());}System.out.println("-----------------------------------------------------");}//111111111111111111111111111111111111111111111111111111111111111111111111111111111private void getAllEmployee(){System.out.println("ID\t姓名\t年龄\t工资\t职位\t状态\t奖金\t股票\t领用设备");Employee[] all = ns.getAll(); //(1)获取所有的员工的信息        for (int i = 0; i < all.length; i++) { //(2)遍历System.out.println(all[i]);//自动调用toString()}}
}

8.4 C:init初始化数组

package com.atguigu.service;
import static com.atguigu.utils.Data.ARCHITECT; //。。。Data.*;
import static com.atguigu.utils.Data.DESIGNER;
import static com.atguigu.utils.Data.EMPLOYEE;
import static com.atguigu.utils.Data.EMPLOYEES;
import static com.atguigu.utils.Data.EQIPMENTS;
import static com.atguigu.utils.Data.NOTEBOOK;
import static com.atguigu.utils.Data.PC;
import static com.atguigu.utils.Data.PRINTER;
import static com.atguigu.utils.Data.PROGRAMMER;
import com.atguigu.bean.Architect;
import com.atguigu.bean.Designer;
import com.atguigu.bean.Employee;
import com.atguigu.bean.Equipment;
import com.atguigu.bean.NoteBook;
import com.atguigu.bean.PC;
import com.atguigu.bean.Printer;
import com.atguigu.bean.Programmer;
import com.atguigu.exception.TeamException;public class NameListService {private Employee[] all;//用来存储全公司的员工对象  public NameListService(){init();}private void init(){ //初始Employ[] all数组的方法,数据的来源是Data.java//(1)创建all数组,并指定长度,原本[ Date.EMPLOYEES.length ],导包后【import static com.atguigu.utils.Data.*】省略Date.all = new Employee[EMPLOYEES.length];  //(2)遍历Data中EMPLOYEES的二维数组,把一行一行的数据封装为一个一个的Employee,Programmer等的对象,放到all数组中for (int i = 0; i < EMPLOYEES.length; i++) {     int empType = Integer.parseInt(EMPLOYEES[i][0]); //EMPLOYEES[i][0]是员工类型    ,string转为int            //因为每一种员工,都有id,name,age,salary,所以这些数据的读取转换,放在switch的上面int id = Integer.parseInt(EMPLOYEES[i][1]); //EMPLOYEES[i][1]是员工编号id            String name = EMPLOYEES[i][2]; //EMPLOYEES[i][2]是员工姓名name                  int age = Integer.parseInt(EMPLOYEES[i][3]); //EMPLOYEES[i][3]是员工年龄age                     double salary = Double .parseDouble(EMPLOYEES[i][4]); //EMPLOYEES[i][4]是员工薪资salary     switch(empType){case EMPLOYEE: //应该是Data.EMPLOYEE,因为有静态导入所以省略Data.  //              all[i] = 创建Employee对象;all[i] = new Employee(id, name, age, salary); break;case PROGRAMMER: //Data.java中定义过PROGRAMMER=11
//              all[i] = 创建Programmer对象;getEquipmentByLineNumber(i)得到一个设备对象all[i] = new Programmer(id, name, age, salary, getEquipmentByLineNumber(i));break; case DESIGNER:
//              all[i] = 创建Designer对象;double bonus = Double.parseDouble(EMPLOYEES[i][5]);all[i] = new Designer(id, name, age, salary, getEquipmentByLineNumber(i), bonus);break;case ARCHITECT:
//              all[i] = 创建Architect对象;bonus = Double.parseDouble(EMPLOYEES[i][5]);int stock = Integer.parseInt(EMPLOYEES[i][6]);all[i] = new Architect(id, name, age, salary, getEquipmentByLineNumber(i), bonus, stock);break;            }}}//11111111111111111111111111111111111111111111111111111111111111111111111111111      private Equipment getEquipmentByLineNumber(int i){ //读取第i行的设备对象int eType = Integer.parseInt(EQIPMENTS[i][0]); //读取设备的类型,即EQIPMENTS[i][0]switch(eType){case PC:return new PC(EQIPMENTS[i][1], EQIPMENTS[i][2]);case NOTEBOOK:return new NoteBook(EQIPMENTS[i][1], Double.parseDouble(EQIPMENTS[i][2]));case PRINTER:return new Printer(EQIPMENTS[i][1], EQIPMENTS[i][2]);}return null;}//111111111111111111111111111111111111111111111111111111111111111111111111111public Employee[] getAll(){ //返回所有的员工对象return all;}//1111111111111111111111111111111111111111111111111111111111111111111111111111public Employee getEmployeeById(int id) throws TeamException{ //根据员工编号,获取员工对象for (int i = 0; i < all.length; i++) {if(all[i].getId() == id){return all[i];}}throw new TeamException(id+"对应的员工不存在");}
}
package com.atguigu.service;
import java.util.Arrays;
import com.atguigu.bean.Architect;
import com.atguigu.bean.Designer;
import com.atguigu.bean.Employee;
import com.atguigu.bean.Programmer;
import com.atguigu.bean.Status;
import com.atguigu.exception.TeamException;public class TeamService {private Programmer[] team;//用来装开发团队的成员//因为开发团队,要求必须是程序员、设计师、架构师private int total;//记录实际开发团队的成员的数量private static final int MAX_MEMBER = 5;private int currentMemberId = 1;  //只增不减 public TeamService(){team = new Programmer[MAX_MEMBER];}   //1111111111111111111111111111111111111111111111111111111111111111111111111111111   public void addMember(Employee emp) throws TeamException{ //添加一个团队成员if(total >= MAX_MEMBER){ //(1)判断总人数throw new TeamException("成员已满,无法添加");}      if(!(emp instanceof Programmer)){ //(2)判断是否是程序员或它子类的对象throw new TeamException("该成员不是开发人员,无法添加");}      //如果要获取状态信息,需要把emp对象向下转型Programmer p = (Programmer) emp; //(3)判断状态switch(p.getStatus()){case BUSY:throw new TeamException("该员已是团队成员");case VOCATION:throw new TeamException("该员正在休假,无法添加");}     //现统计当前team中的每一个类型的对象的人数int pCount = 0;//程序员人数 //(4)判断每一种人的人数int dCount = 0;//设计师人数int aCount = 0;//架构师人数        //这里用total,有几个人统计几个人for (int i = 0; i < total; i++) {//条件判断有顺序要求if(team[i] instanceof Architect){aCount++;}else if(team[i] instanceof Designer){dCount++;}else{pCount++;}}   //如果刚才传入的emp-->p,是架构师,我们再看架构师够不够//如果刚才传入的emp-->p,是设计师,我们再看设计师够不够//如果刚才传入的emp-->p,是程序员,我们再看程序员够不够if(emp instanceof Architect ){if(aCount >= 1){throw new TeamException("团队中只能有一名架构师");}}else if(emp instanceof Designer ){if(dCount >= 2){throw new TeamException("团队中只能有两名设计师");}}else{if(pCount >= 3){throw new TeamException("团队中只能有三名程序员");}}       //添加之前,修改状态,分配团队编号p.setStatus(Status.BUSY); //(5)可以正常添加p.setMemberId(currentMemberId++);team[total++] = p; //添加到team数组}  //111111111111111111111111111111111111111111111111111111111111111111111111111   public Programmer[] getAllMembers(){ //返回所有团队成员return Arrays.copyOf(team, total);}//111111111111111111111111111111111111111111111111111111111111111111111111111 //根据团队编号删除团队成员public void removeMemberByTid(int tid) throws TeamException{//(1)要查找tid成员对应的下标indexint index = -1;//这里用total,有几个人判断几个人for (int i = 0; i < total; i++) {if(team[i].getMemberId() == tid){index = i;break;}}if(index == -1){throw new TeamException(tid + "的团队成员不存在!");}      //(2)先修改要被删除的成员的一些信息//team[index]这个成员要被删除team[index].setStatus(Status.FREE);team[index].setMemberId(0);     //(3)把index后面的元素往前移动/** 如果记不住,如何推断* 第一个参数:原数组* 第二个参数:从哪个开始移动* 第三个参数:目标数组* 第四个参数:第二个参数的下标的元素移动到哪个下标,例如:index+1位置的元素移动到index* 第五个参数:一共移动几个* * 假设total = 5个,删除index= 1位置的元素* 移动[2]->[1],[3]->[2],[4]->[3]  3个  =total - index - 1*/System.arraycopy(team, index+1, team, index, total-index-1);       //(4)把最后一个置为nullteam[total--] = null;//使得这个对象尽快被回收,腾出内存     }
}

8.5 main函数:TeamView

package com.atguigu.test;
import com.atguigu.view.TeamView;public class TeamTest {public static void main(String[] args) {TeamView t = new TeamView();t.menu();}
}

8.6 工具:异常,数据,TSUtility

package com.atguigu.exception;public class TeamException extends Exception{public TeamException() {super();}public TeamException(String message) {super(message);}
}
package com.atguigu.utils;public class Data {public static final int EMPLOYEE = 10;public static final int PROGRAMMER = 11;public static final int DESIGNER = 12;public static final int ARCHITECT = 13;public static final int PC = 21;public static final int NOTEBOOK = 22;public static final int PRINTER = 23;//Employee  :  10, id, name, age, salary//Programmer:  11, id, name, age, salary//Designer  :  12, id, name, age, salary, bonus//Architect :  13, id, name, age, salary, bonus, stockpublic static final String[][] EMPLOYEES = {{"10", "1", "段誉", "22", "3000"},{"13", "2", "令狐冲", "32", "18000", "15000", "2000"},{"11", "3", "任我行", "23", "7000"},{"11", "4", "张三丰", "24", "7300"},{"12", "5", "周芷若", "28", "10000", "5000"},{"11", "6", "赵敏", "22", "6800"},{"12", "7", "张无忌", "29", "10800","5200"},{"13", "8", "韦小宝", "30", "19800", "15000", "2500"},{"12", "9", "杨过", "26", "9800", "5500"},{"11", "10", "小龙女", "21", "6600"},{"11", "11", "郭靖", "25", "7100"},{"12", "12", "黄蓉", "27", "9600", "4800"}};//PC      :21, model, display//NoteBook:22, model, price//Printer :23, type, namepublic static final String[][] EQIPMENTS = {{},{"22", "联想Y5", "6000"},{"21", "宏碁 ", "AT7-N52"},{"21", "戴尔", "3800-R33"},{"23", "激光", "佳能 2900"},{"21", "华硕", "K30BD-21寸"},{"21", "海尔", "18-511X 19"},{"23", "针式", "爱普生20K"},{"22", "惠普m6", "5800"},{"21", "联想", "ThinkCentre"},{"21", "华硕","KBD-A54M5 "},{"22", "惠普m6", "5800"}};
}
package com.atguigu.utils;
import java.util.*;public class TSUtility {private static Scanner scanner = new Scanner(System.in);public static char readMenuSelection() {char c;for (; ; ) {String str = readKeyBoard(1, false);c = str.charAt(0);if (c != '1' && c != '2' &&c != '3' && c != '4') {System.out.print("选择错误,请重新输入:");} else break;}return c;}public static void readReturn() {System.out.print("按回车键继续...");readKeyBoard(100, true);}public static int readInt() {int n;for (; ; ) {String str = readKeyBoard(2, false);try {n = Integer.parseInt(str);break;} catch (NumberFormatException e) {System.out.print("数字输入错误,请重新输入:");}}return n;}public static char readConfirmSelection() {char c;for (; ; ) {String str = readKeyBoard(1, false).toUpperCase();c = str.charAt(0);if (c == 'Y' || c == 'N') {break;} else {System.out.print("选择错误,请重新输入:");}}return c;}private static String readKeyBoard(int limit, boolean blankReturn) {String line = "";while (scanner.hasNextLine()) {line = scanner.nextLine();if (line.length() == 0) {if (blankReturn) return line;else continue;}if (line.length() < 1 || line.length() > limit) {System.out.print("输入长度(不大于" + limit + ")错误,请重新输入:");continue;}break;}return line;}
}

【Java7】练习:选角色,挑苹果,员工类,换心脏,斗地主,发工资,客户信息管理软件,开发团队调度系统相关推荐

  1. 软件开发团队在苹果iPhone上日进千金

    朱连兴日进千金的财富故事不过是苹果及类似模式掀起的创富时代的开篇 游戏者拿着iPhone手机不停地左摇右晃,几米外,电脑上的赛车也随着左突右冲. 在游戏者摇晃iPhone的同时,手机中的重力感应系统已 ...

  2. P001【项目一】客户信息管理软件_Customer类(2)

    客户信息管理软件_问题描述汇总 Customer 类的详细代码 CustomerList 类的详细代码 CustomerView 类的详细代码 CMutility 类的详细代码 实体对象Custome ...

  3. 软件开发团队中的角色

    一个NBA球队场上球员的组成与软件团队有相通之处,且作一笑谈,不足为证: 1号位,控球后卫(PG),他是球场上拿球机会最多.掌握比赛.组织进攻的人,不仅负责把球从后场安全地带到前场,再把球传给队友,给 ...

  4. 软件开发团队常见角色职责

    职责定位,专业的事由专业的人去做 一般一个团队中包含一下这些分工角色:技术总监.项目经理.项目助理.系统分析.产品经理.leader,主程.辅程.测试.美工,DBA等,他们的大致职责描述如下. 技术总 ...

  5. 软件开发团队常见角色职责【转】

    职责定位,专业的事由专业的人去做 一般一个团队中包含一下这些分工角色:技术总监.项目经理.项目助理.系统分析.产品经理.leader,主程.辅程.测试.美工,DBA等,他们的大致职责描述如下. 技术总 ...

  6. 如何对软件项目团队成员进行角色和岗位的划分

    职责和角色不清楚往往是造成软件项目团队管理混乱的一个重要原因,一个好的软件团队必须根据团队规模的不同和项目本身的特点对项目成员的角色和岗位进行明确的划分,这样团队中的每个成员才可能有清晰的责任和目标. ...

  7. 苹果CEO库克首访印度,打算招揽软件开发人才?

    据外媒报道,在苹果CEO蒂姆·库克(Tim Cook)即将抵达印度展开首次访问的几个小时前,两位消息人士透露,苹果公司将宣布计划扩大其在印度的软件开发中心,并推出一个面向当地初创企业的加速器计划. 库 ...

  8. 苹果员工“神操作”:自建网站揭露公司性骚扰和歧视事件

    整理 | 王晓曼​ 出品 | 程序人生 (ID:coder _life) 8月24日上午,苹果公司的员工组织又迈出了一步,推出了一个名为AppleToo的网站.其目标是收集组织各级员工经历过骚扰或歧视 ...

  9. Java面向对象之继承,方法重写,super关键字,员工类系列继承题

    在程序中,如果想声明一个类继承另一个类,需要使用extends关键字. 格式: class 子类 extends 父类 {} 继承的好处 1.继承的出现提高了代码的复用性,提高软件开发效率. 2.继承 ...

最新文章

  1. c++连接oracle数据库程序,无法从c++程序连接到我的oracle数据库
  2. 学python对学习有帮助吗-自学python有用吗?
  3. UE选择合适的小区进行驻留以后
  4. JZOJ 3943. 【GDOI2015模拟11.29】环游世界
  5. python读取只读word只读_人生苦短我学Python——Word处理之快速Word转PDF
  6. Gradle sync failed: Minimum supported Gradle version is 3.3.Current version is 3.2
  7. 程序员晒追女神聊天截图,坦言第一次没经验,网友直呼凭实力单身
  8. python 对象_python中对象可不可以
  9. 五年了,我在 CSDN 的两个一百万。
  10. 【JavaScript】打印星型金字塔
  11. win10远程桌面_怎么选择Win10系统版本?家庭版与专业版的对比介绍
  12. 计算机计算公式单组数据求乘法,excel怎么算乘法
  13. 十年之前..., 十年之后...
  14. jsp:使用jsp完成数据的分页显示
  15. 大米手机现身了,小米一脸蒙圈?大米好么?好在哪里呢?
  16. 【电机控制】Arduino mega 2560控制42步进电机接线
  17. java可以用vs编程吗_vscode可以写java么_编程开发工具
  18. OpenNLP ngram n元语法模型(简介)
  19. 计算机组装与维护手写笔记,科学网—计算机技术的简单小结 - 熊伟的博文
  20. html 轮播图自适应,JavaScript 自适应轮播图

热门文章

  1. mac 下 使用 brew 配置 环境
  2. 给定一个年份,判断这一年是不是闰年。
  3. cdr 表格自动填充文字_「Excel技巧」Excel也可以实现自动填充26英文字母编号
  4. Java黑皮书课后题第6章:*6.6(显示图案)编写方法显示如下图案:public static void displayPattern(int n)
  5. 【Spring源码分析】Bean加载流程概览
  6. /etc/resolv.conf服务器客户端DNS重要配置文件
  7. docker配置国内镜像
  8. C\C++ 位域操作
  9. 安装laravel5.1项目命令
  10. jQuery 插件 Validation表单验证 使用步骤(详细的)