第十章 作业
上机练习5
public class Customer {
public String cardType;
public int score;
public void show() {
System.out.println("积分"+score+"卡类型"+score);
if(cardType.equals("金卡")&&score>1000){
System.out.println("回馈积分"+500);
}else if(score>5000) {
System.out.println("回馈积分"+500);
}else {
System.out.println("没有回馈积分");
}
}
}
public class TestCustomer {
public static void main(String[] args) {
Customer customer=new Customer(); 、
customer.cardType="金卡";
customer.score=50000;
customer.show();
}
}
第三题,第四题
public class CurrentTime
{
public String currentTime="2013年12月7日 08:51:42";
public void show(){
System.out.println("当前时间是"+currentTime);
}
}
public class Demo {
public static void main(String[] args)
{
CurrentTime ct=new CurrentTime();
ct.currentTime="2013年12月7日 08:51:50";
ct.show();
}
}
}
第五题
public class Computer
{
public String CPU;
public String BIOS;
public String screen;
public String disk;
public String memory;
public void show(){ 、
System.out.println("CUP"+CPU);
System.out.println("主板"+BIOS);
System.out.println("显示器"+screen);
System.out.println("硬盘"+disk);
System.out.println("内存"+memory );
}
}
public class TestComputer
{
public static void main(String[] args)
{
Computer computer=new Computer();
computer.CPU="Intel";
computer.BIOS="技嘉";
computer.disk="希捷";
computer.memory="金士顿";
computer.screen="LG";
computer.show();
}
}
第十章作业
最新推荐文章于 2020-06-10 11:59:01 发布