请帮我编个JAVA 程序!本人初学者!感激不尽!

来源:百度知道 编辑:UC知道 时间:2024/06/04 04:22:09
A supermarket is requesting you to develop a simple order taking software to records its day to day orders taken from customers. You have just done an investigation and found that the system work like this:
A customer can place as many orders to the supermarket as he like. Each order consisting one or more products sell in the supermarket. The order consist of information such as shipping address, customer name, products ordered, total amount, total discount, balance, total paid, and order date. Each order is ordered by only one customer. A product has name and selling price. Product can be ordered by many customers and the same customer can order the same product many times. Develop the back-end system for the supermarket and also provide testing front-end software.

一间超级市场请你制定一个简单的软件以便采取记录其每天从客户那的订单。你刚才做了调查,并发现该系统的工作这样的:
客户可以要求超市很多。一个或多个产品销售在超市。该要求组成的信息,如送货地址,客户名称,产品订购,总金额,总折扣,平衡,总支付,和支付的日期。每个要求只有一个客户,产品名称和销售价格。产品可被许多客户和相同的客户订购,可以以同样的产品很多次。

只要能用 JAVA

import java.util.ArrayList;
import java.util.List;
public class SuperMarket {
public static void main(String[] args) {
Product shirt = new GeneralProduct();
shirt.setName("Shirt");
shirt.setPrice(128.0f);

Product meat = new GeneralProduct();
meat.setName("Meat");
meat.setPrice(12);

Customer c = new Customer("Haha");

Order order = new GeneralOrder();
order.setDate(System.currentTimeMillis());
order.setCustomer(c);
order.addProduct(shirt);
order.addProduct(meat);
order.send();

c.printOrder();
}
}
interface Product{
void setName(String name);
void setPrice(float p);
String getName();
float getPrice();
void printInfo();
}
interface Order{
void setDate(long date);
void setCustomer(Customer c);
void addProduct(Product p);
long getDate();