可选中1个或多个下面的关键词,搜索相关资料。也可直接点“搜索资料”搜索整个问题。
在成都网站设计、成都网站制作过程中,需要针对客户的行业特点、产品特性、目标受众和市场情况进行定位分析,以确定网站的风格、色彩、版式、交互等方面的设计方向。创新互联建站还需要根据客户的需求进行功能模块的开发和设计,包括内容管理、前台展示、用户权限管理、数据统计和安全保护等功能。
超市
java
代码
这个不难,先把业务想清楚,然后建数据库,然后java代码把功能实现。2天应该够了,加油!
刚好我们做了一个,一个是本地pos,一个是远程pos,远程用oracle数据库,本地用mysql数据库。可以断网用也可以连网用,别35金币了,十万就行了。
public class ShopGoodsDemo {
public static void main(String[] args) {
ShopCar s1=new ShopCar(5);
s1.add(new EatFood("面包",12.1));
s1.add(new EatFood("辣条",2.4));
s1.add(new EatFood("饼干",22.3));
s1.add(new WashGoods("洗发水",32.5));
s1.add(new WashGoods("卫生纸",22.8));
print(s1.search("饼干"));
System.out.println("=============");
print(s1.getGoods());
}
public static void print(Goods gs[]){
double sum=0;
for(int i=0;igs.length;i++){
if(gs[i]!=null){
//System.out.println(p[i]+",");
System.out.println(gs[i].getName()+","+gs[i].getPrice());
sum=sum+gs[i].getPrice();
}
}
System.out.println("总价格为:"+sum);
}
}
public interface Goods {
public String getName();
public double getPrice();
}
public class EatFood implements Goods{
private String name;
private double price;
public EatFood() {
}
public EatFood(String name, double price) {
super();
this.name = name;
this.price = price;
}
@Override
public double getPrice() {
return this.price;
}
public void setPrice(double price) {
this.price = price;
}
public void setName(String name) {
this.name = name;
}
@Override
public String getName() {
return this.name;
}
}
public class WashGoods implements Goods{
private String name;
private double price;
public WashGoods() {
}
public WashGoods(String name, double price) {
super();
this.name = name;
this.price = price;
}
@Override
public double getPrice() {
return this.price;
}
public void setPrice(double price) {
this.price = price;
}
public void setName(String name) {
this.name = name;
}
@Override
public String getName() {
return this.name;
}
}
public class ShopCar {
private Goods goods[]=null;
private int foot;
//数组的大小由程序外部决定
public ShopCar(int len) {
if(len0){
goods=new Goods[len];
}else{
goods=new Goods[1];
}
}
//判断数组的内容是否已满,未满,则添加
public boolean add(Goods g){
if(this.footthis.goods.length){
this.goods[foot]=g;
foot++;
return true;
}else{
return false;
}
}
//关键字查找
public Goods[] search(String keyword){
Goods go[]=null;
int count=0;
for(int i=0;ithis.goods.length;i++){
if(goods[i]!=null){
if(this.goods[i].getName().indexOf(keyword)!=-1){
count++;
}
}
}
go=new Goods[count];
int f=0;
for(int i=0;ithis.goods.length;i++){
if(goods[i]!=null){
if(this.goods[i].getName().indexOf(keyword)!=-1){
go[f]=this.goods[i];
f++;
}
}
}
return go;
}
//得到全部信息
public Goods[] getGoods(){
return this.goods;
}
}
package entity;
public class Market {
private int id;//id
private int num;//数量
private String goods;//商品
private double price;//价格
public Market(int id, int num, String goods, double price) {
super();
this.id = id;
this.num = num;
this.goods = goods;
this.price = price;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getGoods() {
return goods;
}
public void setGoods(String goods) {
this.goods = goods;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double calc( ){
double sum=price*num;
System.out.println("您消费共计:"+sum+"¥");
return sum;
}
}
package test;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import entity.Market;
public class Test {
private static MapInteger,Market goods=new HashMapInteger, Market();
public static void main(String[] args) {
System.out.println("-------超市计价系统-------");
String goods1="可口可乐";
String goods2="爆米花";
String goods3="益达";
printTable("编号","商品","价格");
printTable("1",goods1,"3.0¥");
printTable("2",goods2,"5.0¥");
printTable("3",goods3,"10.0¥");
goods.put(1, new Market(1, 1, goods1, 3.0));
goods.put(2, new Market(2, 1, goods2, 5.0));
goods.put(3, new Market(3, 1, goods3, 10.0));
Scanner input = new Scanner(System.in);
System.out.println("请输入商品的编号:");
int num = input.nextInt();
System.out.println("请输入商品的数量");
int amount = input.nextInt();
Market market = goods.get(num);
market.setNum(amount);
market.calc();
}
private static void printTable(String row1,String row2,String row3 ) {
System.out.print(row1);
int times=12;
if (row2!="商品") {
times=5;
}
for (int i = 0; i times; i++) {
System.out.print(" ");
}
System.out.print(row2);
for (int i = 0; i 10; i++) {
System.out.print(" ");
}
System.out.print(row3);
System.out.println("\n");
}
}
//测试结果:
-------超市计价系统-------
编号 商品 价格
1 可口可乐 3.0¥
2 爆米花 5.0¥
3 益达 10.0¥
请输入商品的编号:
3
请输入商品的数量
5
您消费共计:50.0¥
System.out.println("您确定要退出小超市收银管理系统(Y/N)?");
System.in();
char s=System.getInput();
switch(s){
case 'Y':System.exit(0);break;
case 'N':;
break;
}