📄 test.java
字号:
import java.io.*;
import java.util.*;
public class test
{
public static void main(String[] args)
{
String customerName;
String marketName;
Scanner in =new Scanner(System.in);
System.out.println("enter your name!\n");
customerName=in.nextLine();
System.out.println("enter the market name");
marketName=in.nextLine();
abs theAbs=new head(customerName,marketName);
theAbs =new body(theAbs);
System.out.println("Assume that you buy 3 food which is 4 dollars each,\n");
System.out.println("and then you buy 5 clothes which is 20 dollars each\n");
theAbs=new food(4.0,3,theAbs);
theAbs=new clothes(20.0,5,theAbs);
theAbs=new tail(theAbs);
theAbs.display();
System.out.println("\n\n\nAssume you buy something else in another way\n");
abs another=new anotherHead();
another=new body(another);
System.out.println("Assume that you buy 5 food which is 10 dollars each,\n");
System.out.println("and then you buy 3 clothes which is 15 dollars each\n");
another=new food(10.0,5,another);
another=new clothes(15.0,3,another);
another=new anotherTail(another);
another.display();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -