java购物系统源代码_第1页
java购物系统源代码_第2页
java购物系统源代码_第3页
java购物系统源代码_第4页
java购物系统源代码_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、package import *系统开启类* author Administrator*/public class StartSMS public StartSMS() public static void main(Stringargs ) Data data = new Data();();Menu menu = new Menu();();boolean flag = true ;labelO:do if (! flag )break ;Scanner scanner = new Scanner;int i =();VerifyEqual verifyequal = new Verify

2、Equal(); switch ( i ) case 1: quals( "n" ) Menu menu = new Menu();(goodsName, goodsPrice , custNo , custBirth custScore );(); else "输入错误,请重新'n'返回上一级菜单:");flag = false ;while (! flag );public void add() "购物管理系统 > 客户信息管理 > 添加客户信息nn");Scanner scanner = new Sc

3、anner;"请输入会员号(<4位整数>):");int i =();"请输入会员生日(月/日 <用两位数表示>):");Stri ng s =();"请输入积分:");intj=();intk= -1;intl= 0;do if ( l >=break ;if ( custNo l = 0) k = l ; break ;l +; while ( true );custNo k = i ; custBirth k =s;custScore k = j ;"新会员添加成功!");ret

4、urnLastMe nu();public void modify() 客户信息管理 > 修改客户信息nn");Scanner scanner =new Scanner;生日IIint" 会hi =();含员号int| | j = -1;intk = 0;do if ( k >=break ;if ( custNo k=i) Stri ngBuilder().appe nd("购物管理系统>"请输入会员号:");积分 "););custNo k).append( custBirth k).append( "

5、tt".appe nd(custScore k).toString(); j = k; break ;k+;.append( "tt" while ( true ); if ( j != -1) .println(*n");"tttt1.修 改 会 员 生 日 .n" );"tttt2.修 改 会 员 积 分 .n" );.println( "* * * * * * * * * * * * *n"" 请选择,输入数字: "); switch () case 1: ppend(

6、 custNo j );.append( "tt").append( custBirthj ).append( "tt".append( custScore j ).toString();flag = true ; break ;j +; while ( true );if (! flag )" 抱歉,没有你查询的会员信息。 ");"n 要继续查询吗( y/n ):" );returnLastMenu();public void show() " 购物管理系统 > 客户信息管理 > 显示客户信

7、息 nn" );" 会员号 生日 积分 " ); "|" );int i = ;for ( int j = 0; j < i && custNo j != 0;j +)StringBuilder().append( custNo j ).append("tt" ).append( custBirth j ).append( "tt" ).append( custScore j ).toString();returnLastMenu();public public public pub

8、lic publicString goodsName; double goodsPrice ; int custNo ;String custBirth ;int custScore ;package/*初始化数据author Administrator*/public class Data public Data() goodsName = new String50; goodsPrice = new double 50; custNo = new int 100; custBirth = new String100; custScore = new int 100; manager = n

9、ew Manager();public void ini() goodsName0 = "addidas 运动鞋 " goodsPrice 0 = 880D;goodsName1 = "Kappa 网球裙 " goodsPrice 1 = 200D;goodsName2 = " 网球拍 " goodsPrice 2 = 780D;goodsName3 = "addidasT 恤" goodsPrice 3 = ;goodsName4 = "Nike 运动鞋 " goodsPrice 4 = 90

10、0D;goodsName5 = "Kappa 网球 " goodsPrice 5 = 45D;goodsName6 = "KappaT 恤" goodsPrice 6 = 245D;custNo 0 = 1900; custBirth 0 = "08/05" ; custScore 0 = 2000;custNo 1 = 1711; custBirth 1 = "07/13" ; custScore 1 = 4000;custNo 2 = 1623; custBirth 2 = "06/26"

11、;custScore custNo 3 custBirth custScore custNo 4 custBirth custScore custNo 5 custBirth custScore custNo 6 custBirth custScore 2 = 5000;= 1545;3 = "04/08"3 = 2200;= 1464;4 = "08/16"4 = 1000;= 1372;5 = "12/23"5 = 3000;= 1286;6 = "12/21"6 = 10080;6public String

12、goodsName; public double goodsPrice ; public int custNo ;public String custBirth ; public int custScore ; public Manager manager ;package * 礼物类*/public class Gift public Gift() " 一个价值public String toString() return ( new StringBuilder().append(¥").append( price ).append("的")

13、 .append( name).toString();public String name; public double pricepackageimport礼物管理类* author Administrator*/public class GiftManagement public GiftMa nageme nt() public void setData(String as, double ad, int ai , Stri ngas1 ,int ai1 ) goodsName = as; goodsPrice = ad; custNo = ai ; custBirth = as1 ;

14、custScore = ai1 ;public void returnLastMenu() "nn请按'n'返回上一级菜单:");Scanner scanner = new Scanner; boolean flag = true ;doif ().equals( "n" ) Menu menu = new Menu();(goodsName, goodsPrice , custNo , custBirth custScore );(); else "输入错误,请重新'n'返回上一级菜单:");flag

15、 = false ;while (! flag );public void sendBirthCust() "购物管理系统 > 生日问候nn");"请输入今天的日期(月/日 <用两位表示>):");Scanner scanner = new Scanner;Stri ngs =();Strings1 =""boolean flag = false ;for ( int i = 0; i < ; i +)if ( custBirth i != null &&custBirth i .equals(

16、 s) si =( newStringBuilder().append(s1).append( custNo i ).append("n" ).toString();flag = true ;if ( flag ) "过生日的会员是:");"恭喜!获赠MP旷个!"); else "今天没有过生日的会员!");returnLastMe nu(); public void sendLuckyCust() "购物管理系统 > 幸运抽奖nn");"是否开始(y/n ):");S

17、canner scanner = new Scanner;if ().equals( "y" ) int i = ( int ) () * 10D);boolean flag = false ;String s =""for (int k = 0; k < && custNo k != 0;k+) intj = ( custNo k / 100) % 10;if(j = i) s = ( newStri ngBuilder().appe nd(s).append( custNo k).append( "t" ).

18、toString();flag = true ;if (flag)StringBuilder().append("幸运客户获赠 MP3:).append( s).toString();else"无幸运客户。");returnLastMe nu(); public void sendGoldenCust() " 购物管理系统 > 幸运大放送 nn" );int i = 0;int j = custScore 0;for ( int k = 0; k < && custScore k != 0;k+)if ( custS

19、core k > j ) j = custScore k;i = k;II具有最高积分的会员是:StringBuilder().append(" ).append(custNo i ).append( "t" ).append( custBirth i ).append( "t" ) .append( custScore i ).toString();Gift gift = new Gift();= " 苹果笔记本电脑 "= 12000D;" 恭喜!获赠礼品: " );returnLastMenu(

20、);public String goodsName; public double goodsPrice ; public int custNo ;public String custBirth ; public int custScore ;7package /*管理员类* author Administrator*/public class Manager public Manager() username = "itcast" password = "itcast"public String username ; public String pass

21、word ;package import * 页面类* author Administrator*/ public class Menu public Menu() public void setData(String as, double ad, int ai , String as1 ,int ai1 ) goodsName = as; goodsPrice = ad; custNo = ai ; custBirth = as1; custScore = ai1 ;public void showLoginMenu() "nnttt欢迎使用 itcast 购物管理系统版 nn&q

22、uot; );.println(* * * * * * * * * * * * * *n" "tttt 1."tttt 2."tttt 3.*);登 录 系 统 nn" );更 改 管 理 员 密 码 nn" ); 退 出 nn" );"tttt 3.修改.println(* * * * * * * * * * * * * * * * * * *n" "请选择, 输入数字:" );public void showMainMenu() "nntttt 欢迎使用购物管理系统 n&

23、quot; );.println("* * * * * * * * * * *);* * *n""tttt 2.购物结算n");"tttt 3.真情 回 馈n");"tttt 4.注销n");prin tl n("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *n");"请选择,输入数字:");Scanner seanner = new Scanner;booleanflag = false ;do Stri

24、ng s =();if("1" ) showCustMMe nu();break ;if("2" ) Pay pay = new Pay();pay.setData(goodsName, goodsPricecustNo , custBirth ,custScore );(); break ;if("3" ) showSe ndGMe nu();break ;if("4" ) showLogi nMenu();break ;"输入错误,请重新输入数字:"); flag = false ; whi

25、le (! flag );public void showCustMMenu() "购物管理系统 > 客户信息管理n");.pri ntln(* * * * * * * * * * * * *n""tttt 1.显示"tttt 2.添加*);所有客户信息n");客户信息n");客户信息n");查询客户信息n");.pri ntln("tttt 4.* * * * * * * * * * * * * * * * * * * * * * * *n""请选择,输入数字或按&#

26、39;n'返回上一级菜单:");Scanner seanner = new Scanner; boolean flag = true ;do CustManagement custmanagement = new CustMa nageme nt();(goodsName, goodsPrice , custNo , custBirth custScore );Stri ng s =();if ( "1" ) (); break ;if ( "2" ) (); break ;if ( "3" ) (); break

27、;if ( "4" ) (); break ;if ( "n" ) showMai nMe nu(); break ;"输入错误,请重新输入数字:");flag = false while (! flag ); public void showSendGMenu() .pri ntln("购物管理系统 > 真情回馈n");* * * * * * * * * * * * * * * * * * * * * * * *n""tttt 1."tttt 2.幸运大放送n");

28、幸运抽奖n");生日问候n");"tttt 3.pri ntln(* * * * * * * * * * * * * * * * * * * * * * * *n""请选择,输入数字或按'n'返回上一级菜单:");Scanner seanner = new Scanner;boolean flag = true ;=new GiftMa nageme nt();GiftMa nageme ntgiftma nageme nt(goodsName, goodsPrice , custNo , custBirth cust

29、Score );do Stri ng s =();if ( "1" ) (); break ;if ( "2" ) (); break ;if ( "3" ) (); break ;if ( "n" ) showMai nMe nu(); break ;"输入错误,请重新输入数字:");flag = false while (! flag );public StringgoodsName;public double goodsPrice ; publicintcustNo ;public Str

30、i ngcustBirth ;publicintcustScore ;9package ;import * 购物付款author Administrator*/public class Pay public Pay() public void setData(StringString as1 ,int ai1 ) goodsName = as; goodsPrice = ad; custNo = ai ; custBirth = as1; custScore = ai1 ;as, double ad, int ai ,public double getDiscount( int i , int

31、 ai , int ai1 ) int j = -1;int k = 0;do if ( k >=break ;if ( i = ai k) j = k;break ;k+; while ( true );double d;if ( ai1 j < 1000)d = ;elseif d(1000 <=一 Jai1j &&ai1 j < 2000)elseif(2000 <=ai1j &&ai1 j < 3000)d一 Jelseif(3000 <=ai1j &&ai1 j < 4000)d一 Jel

32、seif(4000 <=ai1j &&ai1 j < 6000)d一 Jelseif(6000 <=ai1j &&ai1 j < 8000)d一 Jelsed一 Jreturnd;public void calcPrice() String s2 = "" ;double d1 =;double d2 =;););"请选择购买的商品编号:");int l = 0;double d4 = 0;for (; l < && goodsName l d4+;Stri ngBuilder

33、().appe nd(!=null ; I +) d4).append(":").append( goodsName l ).append( "t" ).toStri ng();“*n"new Scanner;););Scanner scanner"t请输入会员号: int i =();d4 = getDisco unt( Stri ngs1 ;do IIi , custNo , custScore);"t请输入商i品编号.);intj=();"t请输入数目:");intk=();doiubled =goodsPrice jStrings =goodsName jd1+=d * (double ) k;s2=(new-1;-1;"n""t"Stri ngBuilder().appe nd(¥ ").appe nd( d).appe

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论