tw-oocamp-201512 / the-code-of-you

使用你最喜欢的语言写一段代码来介绍你自己,提交在Issues里
1 stars 1 forks source link

Cao Xiaoqi profile #2

Open xq-cao opened 8 years ago

xq-cao commented 8 years ago
package com.tw.practice;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class Employee{
    private int age;
    private String name;
    private String company;
    private int workingYears;
    private int experienceYears;
    private List<String> languages = new ArrayList<>();

    public Employee(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public void setWorkingYears(int workingYears) {
        this.workingYears = workingYears;
    }

    public void setExperienceYears(int experienceYears) {
        this.experienceYears = experienceYears;
    }

    public void addLanguage(String language) {
        this.languages.add(language);
    }

    public void showProfile() {
        System.out.println("Hello, everyone!");
        System.out.println("Today, I will introduce myself to you guys.");
        System.out.println("My name is " + this.name + ". I'm " + this.age + " years old.");
        System.out.println("I have " + this.experienceYears + " years experience in software development.");
        System.out.println("I joined " + this.company + " for " + this.workingYears + (this.workingYears > 1 ? " years." : " year."));
        System.out.println("I like " + this.languages.stream().collect(Collectors.joining(", ")) + " etc program languages.");
        System.out.println("Thanks everyone.");
    }

    public static void main(String[] args) {
        Employee caoxiaoqi = new Employee("Cao Xiaoqi", 27);
        caoxiaoqi.setCompany("our company");
        caoxiaoqi.setWorkingYears(1);
        caoxiaoqi.setExperienceYears(5);
        caoxiaoqi.addLanguage("C/C++");
        caoxiaoqi.addLanguage("Object-C");
        caoxiaoqi.addLanguage("Java");
        caoxiaoqi.showProfile();
    }
}
xq-cao commented 8 years ago

Hello, everyone! Today, I will introduce myself to you guys. My name is Cao Xiaoqi. I'm 27 years old. I have 5 years experience in the software development. I joined our company for 1 year. I like C/C++, Object-C, Java etc program languages. Thanks everyone.