用JAVA编写购物系统的代码是什么?(急)算是最简单的吧
package cn.job01;
import java.util.Scanner;
public class Lx07 {
public static void choice() {
System.out.println("登陆菜单");
System.out.println("1登陆系统");
System.out.println("2退出");
}
static void choice1() {
System.out.println("购物管理系统客户信息");
System.out.println("1显示所有客户信息");
System.out.println("2添加客户信息");
System.out.println("3修改客户信息");
System.out.println("4查询客户信息");
}
static void choice2() {
System.out.println("购物管理系统真情回馈");
System.out.println("1幸运大放送");
System.out.println("2幸运抽奖");
System.out.println("3生日问候");
}
public static void main(String[] args) {
choice();
Scanner input = new Scanner(System.in);
System.out.println("请输入1or2");
int num = input.nextInt();
switch (num) {
case 1:
System.out.println("主菜单");
System.out.println("1客户信息管理");
System.out.println("2购物结算");
System.out.println("3真情回馈");
System.out.println("4注销");
break;
}
System.out.println("选择输入数字");
int num1 = input.nextInt();
switch (num1) {
case 1:
choice1();
break;
case 2:
System.out.println("购物结算");
break;
case 3:
choice2();
break;
case 4:
choice();
break;
}
}
}
求大神帮忙 , 谢谢?。。。。。ㄒ狫ava代码)//第一题的答案:
import java.util.Scanner;
public class test {
public static void main(String[] args)
{
System.out.println("输入购买金额:");
Scanner input=new Scanner(System.in);
double a=input.nextDouble();
System.out.println("输入顾客类型(会员或普通):");
String b=input.next();
if(b=="会员")
{
if(a=100)
{
a=a*0.8;
System.out.println("需付款:" a);
}
else
{
System.out.println("需付款:" a);
}
}
if(b=="普通")
{
if(a=200)
{
a=a*0.75;
System.out.println("需付款:" a);
}
else
{
System.out.println("需付款:" a);
}
}
}
}
//下面是第二题答案:
public class test {
public static void main(String[] args)
{
for(int i = 0; i3; i)
{
for(int x = i1; x3; x)
{
System.out.print(" ");
}
for(int y = 0; y(i1) * 2 - 1; y)
{
System.out.print("*");
}
System.out.println();
}
for(int i = 0; i4; i)
{
for(int x = 0; xi; x)
{
System.out.print(" ");
}
for(int y = i; y2 * 4 - i - 1; y)
{
System.out.print("*");
}
System.out.println();
}
}
}
java:小明去超市买东西,所有买到的东西都放在了购物车之中,最后到收银台一起结账 。你编出来了是吗求助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() {
}
【收银台的java代码 收银系统程序编写】 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;
}
}
JAVA 简单银行系统的代码import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class AccountDemo {
public static double MONEY = 0;// 初始化金额是100元 。
public static void main(String[] args) {
final String USER_NAME = "zhangsan";// 用户名
final String PASSWORD = "123456";// 密码
while (true) {
System.out.print("请输入用户名:");
String user_name = getString();
System.out.print("请输入密码:");
String password = getString();
if (user_name != nulluser_name.equals(USER_NAME)
password != nullpassword.equals(PASSWORD)) {
System.out.println("登陆成功!你要干什么?");
while (true) {
System.out.println("1:存款");
System.out.println("2:取款");
System.out.println("3:查询余额");
System.out.println("q:退出程序");
System.out.print("请选择:");
String userIn = getString();
int in = 0;
if (userIn != nulluserIn.equals("1")) {
in = Integer.parseInt(userIn);
} else if (userIn != nulluserIn.equals("2")) {
in = Integer.parseInt(userIn);
} else if (userIn != nulluserIn.equals("3")) {
in = Integer.parseInt(userIn);
} else if (userIn != null
userIn.trim().toUpperCase().equals("Q")) {
in = 4;
} else {
System.out.println("你输入的指令不正确!请重新输入 。");
continue;
}
switch (in) {
case 1:
double add_money = 0;
while (true) {
System.out.print("请输入你要存入的金额:");
try {
add_money = Double.parseDouble(getString());
} catch (Exception e) {
System.out.println("金额输入不正确!");
continue;
}
break;
}
MONEY= add_money;
System.out.println("存入的金额是"add_money
"\r\n请选择你要的操作:");
break;
case 2:
double money = 0;
while (true) {
System.out.print("请输入你要取出的金额:");
try {
money = Double.parseDouble(getString());
} catch (Exception e) {
System.out.println("金额输入不正确!");
continue;
}
if (moneyMONEY) {
System.out.println("取出的金额大于现有存款,请重新输入要取出的金额!");
continue;
}
break;
}
MONEY -= money;
System.out.println("取出的金额是"money"\r\n请选择你要的操作:");
break;
case 3:
System.out.println("你的余额是:"MONEY"\r\n请选择你要的操作:");
break;
case 4:
System.out.println("程序退出!");
return;
}
}
} else {
System.out.println("错误:用户名与密码不匹配!\r\n");
System.out.println("按任意键:重新输入用户名和密码 。");
System.out.println("q:退出程序 。");
System.out.print("请选择:");
String in = getString();
if (in.trim().toUpperCase().equals("Q")) {
break;
}
}
}
}
public static String getString() {
String str = null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
求一个用Java Eclipse 链接SQL数据库的超市收银管理系统的源代码 , 这个我可以做收银台的java代码,两天做好交给你收银台的java代码;可以私信我
关于收银台的java代码和收银系统程序编写的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。
推荐阅读
- 小程序开发公司有什么优势,做个小程序开发的公司
- 苹果安卓双系统退款,苹果电脑双系统怎么进入安卓系统
- 任务型模拟经营类手游游戏,任务型游戏叫什么
- 怎么创建虚拟主机端口,创建虚拟主机的三种方式
- linux什么命令启服务 linux系统启动服务的命令
- wordpress关键字插件,WordPress插件
- sap采购审批,sap创建采购申请流程
- 电脑版快手直播斗地主,快手怎么直播玩斗地主
- mysql陷入循环怎么办 内蒙古呼和浩特光大银行地理位置