真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

簡單訂單添加java代碼 簡單訂單添加java代碼

用JAVA編寫購物系統(tǒng)的代碼是什么?(急)

算是最簡單的吧

在平橋等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站制作、成都網(wǎng)站制作 網(wǎng)站設(shè)計(jì)制作按需搭建網(wǎng)站,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),成都全網(wǎng)營銷推廣,成都外貿(mào)網(wǎng)站建設(shè)公司,平橋網(wǎng)站建設(shè)費(fèi)用合理。

package cn.job01;

import java.util.Scanner;

public class Lx07 {

public static void choice() {

System.out.println("登陸菜單 ");

System.out.println("1登陸系統(tǒng)");

System.out.println("2退出");

}

static void choice1() {

System.out.println("購物管理系統(tǒng)客戶信息");

System.out.println("1顯示所有客戶信息");

System.out.println("2添加客戶信息");

System.out.println("3修改客戶信息");

System.out.println("4查詢客戶信息");

}

static void choice2() {

System.out.println("購物管理系統(tǒng)真情回饋");

System.out.println("1幸運(yùn)大放送");

System.out.println("2幸運(yùn)抽獎(jiǎng)");

System.out.println("3生日問候");

}

public static void main(String[] args) {

choice();

Scanner input = new Scanner(System.in);

System.out.println("請(qǐng)輸入1or2");

int num = input.nextInt();

switch (num) {

case 1:

System.out.println("主菜單");

System.out.println("1客戶信息管理");

System.out.println("2購物結(jié)算");

System.out.println("3真情回饋");

System.out.println("4注銷");

break;

}

System.out.println("選擇輸入數(shù)字");

int num1 = input.nextInt();

switch (num1) {

case 1:

choice1();

break;

case 2:

System.out.println("購物結(jié)算");

break;

case 3:

choice2();

break;

case 4:

choice();

break;

}

}

}

java 如何實(shí)現(xiàn)一個(gè)用戶 一個(gè)訂單

package cn.test.logan.day04;

import java.util.ArrayList;

/**

* 訂單類

* 包含:訂單ID、訂單所屬用戶、訂單所包含的商品、訂單總金額、訂單應(yīng)付金額

* 500-1000 ------- 8.5折

* 1000-1500 ------- 8折

* 1500-2000 ------- 7折

* 2000以上 ------- 6.5折

* 如果是會(huì)員,那么可以基于以上折扣繼續(xù)折扣

* 一般會(huì)員:9.5折

* 中級(jí)會(huì)員:9折

* 高級(jí)會(huì)員:8折

* @author QIN

*

*/

public class Order {undefined

// 訂單ID

public String ordId;

// 訂單所屬用戶

public User user;

// 訂單所包含的商品(多個(gè)商品,使用ArrayList)

public ArrayList pds;

// 訂單總金額

public float ordAllAmt;

// 訂單應(yīng)付金額

public float payAmt;

// 計(jì)算總金額的方法

public void setAllAmt() {undefined

float sum = 0;

for(int i=0;i

sum +=this.pds.get(i).price * this.pds.get(i).number;

}

this.ordAllAmt = sum;

}

// 計(jì)算實(shí)付金額

public void setPayAmt() {undefined

float tmp = this.ordAllAmt;

// 根據(jù)總金額進(jìn)行折扣

if(this.ordAllAmt = 500 this.ordAllAmt

tmp = this.ordAllAmt * 0.85f;

}

if(this.ordAllAmt = 1000 this.ordAllAmt

tmp = this.ordAllAmt * 0.8f;

}

if(this.ordAllAmt = 1500 this.ordAllAmt

tmp = this.ordAllAmt * 0.7f;

}

if(this.ordAllAmt = 2000) {undefined

tmp = this.ordAllAmt * 0.65f;

}

// 根據(jù)會(huì)員等級(jí)折扣

if(user.CustLevel.equals("一般會(huì)員")) {undefined

tmp = tmp * 0.95f;

}

if(user.CustLevel.equals("中級(jí)會(huì)員")) {undefined

tmp = tmp * 0.9f;

}

if(user.CustLevel.equals("高級(jí)會(huì)員")) {undefined

tmp = tmp * 0.8f;

}

//計(jì)算結(jié)果賦值給對(duì)象上的payAmt變量

this.payAmt = tmp;

}

}

參考資料來源:百度貼吧CSDN博主「公子京」

生成訂單編號(hào) 用java怎么處理

/**

* 得到一個(gè)新的訂單代碼

* 說明,此函數(shù)還沒有進(jìn)行過多線程測試,更新數(shù)據(jù)庫時(shí)未加鎖

* @return 新的訂單代碼

*/

public String getOrderCode(){

//getParameter這個(gè)方法就是從數(shù)據(jù)庫取2個(gè)參數(shù)的值 ORDER_CODE_DATE 和

//ORDER_CODE_NO是數(shù)據(jù)庫字段名

BasParameters orderCodeDate = getParameter(ORDER_CODE_DATE);

BasParameters orderCodeNo = getParameter(ORDER_CODE_NO);

//當(dāng)前日期

String currDate=new SimpleDateFormat("yyyyMMdd").format(new Date(System.currentTimeMillis()));

//每天的起始數(shù)

int orderNo = 100;

//表里存的日期和當(dāng)前日期相同,順序號(hào)累加

if (currDate.equals(orderCodeDate.getValue())){

orderCodeNo.setValue(""+(Integer.parseInt(orderCodeNo.getValue())+1));

orderNo = (Integer.parseInt(orderCodeNo.getValue()));

//save 就是保存ORDER_CODE_DATE 和 ORDER_CODE_NO當(dāng)前值到數(shù)據(jù)庫

save(orderCodeNo);

} else {

//表里存的日期和當(dāng)前日期不同,順序號(hào)重新開始,更新參數(shù)表的日期

orderCodeDate.setValue(currDate);

save(orderCodeDate);

orderCodeNo.setValue(orderNo);

save(orderCodeNo);

}

return currDate + new DecimalFormat("000000").format(orderNo);

}

java題:編寫類似淘寶一個(gè)簡單的處理訂單發(fā)貨和進(jìn)貨的程序,要求實(shí)現(xiàn)簡單的進(jìn)貨和發(fā)貨以及統(tǒng)計(jì)貨物量的功能

import java.util.ArrayList;

public class Du {

public static void main(String[] args) throws Exception {

Seller seller = new Seller("My Store");

seller.addGoods("T-shirt", 200);

seller.addGoods("Pill", 100);

seller.addGoods("T-shirt", 100);

seller.addGoods("T-shirt", 50);

seller.addGoods("Pill", 50);

seller.addGoods("Hat", 100);

seller.printGoods();

Seller sell2 = new Seller("The Other Store");

sell2.addGoods("T-shirt", 200);

sell2.addGoods("Hat", 100);

sell2.sellGoods("T-shirt", 50);

sell2.addGoods("Hat", 100);

sell2.printGoods();

}

}

class Seller {

private String sellerName;

private int TotalTypeOfGoods;

private ArrayListString goodsNameList = new ArrayListString();

private ArrayListInteger goodsQuantityList = new ArrayListInteger();

public Seller(String sellerName) {

this.sellerName = sellerName;

}

public void addGoods(String goodName, int goodNum) {

int index = goodsNameList.indexOf(goodName);

if (index == -1) {

goodsNameList.add(goodName);

goodsQuantityList.add(new Integer(goodNum));

} else {

goodsQuantityList.set(index, goodsQuantityList.get(index)

.intValue()

+ goodNum);

}

TotalTypeOfGoods = goodsNameList.size();

}

public void sellGoods(String goodName, int goodNum) throws Exception {

if (TotalTypeOfGoods == 0) {

throw new Exception("No goods provided by the shop. Closed!");

}

int index = goodsNameList.indexOf(goodName);

if (index != -1) {

int qty = goodsQuantityList.get(index);

if (goodNum qty) {

throw new Exception("Insufficient goods in the shop. Sorry!");

}

goodsQuantityList.set(index, qty - goodNum);

}else{

throw new Exception("Our shop doesn't sell " + goodName);

}

}

public void printGoods() {

System.out.print("Seller :" + this.sellerName + "\t");

System.out.println("Totoal Types of Goods is :" + this.TotalTypeOfGoods);

for(int i = 0; i goodsNameList.size(); i++){

System.out.print("Goods Name: " + goodsNameList.get(i));

System.out.println("Remains: " + goodsQuantityList.get(i));

}

System.out.println();

}

}

-----------------testing

Seller :My Store Totoal Types of Goods is :3

Goods Name: T-shirtRemains: 350

Goods Name: PillRemains: 150

Goods Name: HatRemains: 100

Seller :The Other Store Totoal Types of Goods is :2

Goods Name: T-shirtRemains: 150

Goods Name: HatRemains: 200


新聞標(biāo)題:簡單訂單添加java代碼 簡單訂單添加java代碼
轉(zhuǎn)載來于:http://weahome.cn/article/dopesoc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部