java购物支付页面代码 java购物支付页面代码是多少
用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;
}
}
}
java编写一个网上支付系统界面
html
head
meta http-equiv="Content-Type" content="text/html; charset=utf-8"
title购物与结算/title
style type="text/css"
/style
link rel="stylesheet" href="
script src="
script src="
script src="
script src="
(beta4)/IE9.js"/script
script src="
script type="text/javascript"
function pay()
{
var link = document.getElementById("a1");
link.click();
var a = new Array();
a[0]="html教程";
a[1]=12;
a[2]=1;
a[3]=a[1]*a[2];
var a1 = new Array();
a1[0]="java详解";
a1[1]=25;
a1[2]=2;
a1[3]=a1[1]*a1[2];
var b = new Array();
b[0]=a;
b[1]=a1;
var amount =0;
for(var i=0;ib.length;i++)
{
var c = new Array();
c=b[i];
amount = amount+c[3];
var tr ="tr";
for(var j=0;jc.length;j++)
{
tr+="td"+c[j]+"/td";
}
tr+="/tr";
$("#list").append(tr);
$("#all").html("b总计:/bfont color=\"red\""+amount+"/font")
}
}
function goon()
{
var link = document.getElementById("a2");
link.click();
$("#news").html("支付成功!!");
}
/script
/head
body
input type="button" class="btn btn-danger" value="点击结算" onclick="pay()"
a href="#myModaltishi" role="button" class="btn" data-toggle="modal" id="a1" style="display: none"/a
div id="myModaltishi" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
div class="modal-header"
button type="button" class="close" data-dismiss="modal" aria-hidden="true"×/button
h3 id="myModalLabel"购物车/h3
/div
div class="modal-body"
div
table id="list" style="width: 95%;" class="table"
th商品名称/th
th单价/th
th数量/th
th金额/th
/table
/div
div align="right" id="all"/div
/div
div class="modal-footer"
button class="btn" data-dismiss="modal" aria-hidden="true"继续挑选/button
button class="btn btn-primary" data-dismiss="modal" onclick="goon()"支付/button
/div
/div
a href="#myModaltishi1" role="button" class="btn" data-toggle="modal" id="a2" style="display: none"/a
div id="myModaltishi1" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
div class="modal-header"
button type="button" class="close" data-dismiss="modal" aria-hidden="true"×/button
h3 id="myModalLabel"系统提示/h3
/div
div class="modal-body"
h3 id="news" align="center"/h3
/div
div class="modal-footer"
button class="btn btn-primary" data-dismiss="modal"知道了/button
/div
/div
/body
!-- 浏览器打开可查看效果,
另外由于页面使用了bootstrap框架建议使用渲染较高的浏览器,例如:火狐 --
/html
你好,java购物车代码?
import java.awt.*;
import java.awt.event.*;
class ShopFrame extends Frame implements ActionListener
{ Label label1,label2,label3,label4;
Button button1,button2,button3,button4,button5;
TextArea text;
Panel panel1,panel2;
static float sum=0.0f;
ShopFrame(String s)
{ super(s);
setLayout(new BorderLayout());
label1=new Label("面纸:3元",Label.LEFT);
label2=new Label("钢笔:5元",Label.LEFT);
label3=new Label("书:10元",Label.LEFT);
label4=new Label("袜子:8元",Label.LEFT);
button1=new Button("加入购物车");
button2=new Button("加入购物车");
button3=new Button("加入购物车");
button4=new Button("加入购物车");
button5=new Button("查看购物车");
text=new TextArea("商品有:"+"\n",5,10);
text.setEditable(false);
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent e)
{ System.exit(0);
}
}
);
button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);
button5.addActionListener(this);
panel1=new Panel();
panel2=new Panel();
panel1.add(label1);
panel1.add(button1);
panel1.add(label2);
panel1.add(button2);
panel1.add(label3);
panel1.add(button3);
panel1.add(label4);
panel1.add(button4);
panel2.setLayout(new BorderLayout());
panel2.add(button5,BorderLayout.NORTH);
panel2.add(text,BorderLayout.SOUTH);
this.add(panel1,BorderLayout.CENTER);
this.add(panel2,BorderLayout.SOUTH);
setBounds(100,100,350,250);
setVisible(true);
validate();
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==button1)
{ text.append("一个面纸、");
sum=sum+3;
}
else if(e.getSource()==button2)
{ text.append("一只钢笔、");
sum=sum+5;
}
else if(e.getSource()==button3)
{ text.append("一本书、");
sum=sum+10;
}
else if(e.getSource()==button4)
{ text.append("一双袜子、");
sum=sum+8;
}
else if(e.getSource()==button5)
{
text.append("\n"+"总价为:"+"\n"+sum);
}
}
}
public class Shopping {
public static void main(String[] args) {
new ShopFrame("购物车");
}
}
我没用Swing可能显示不出来你的效果。不满意得话我在给你编一个。
求大神帮忙,谢谢!!!!!(要Java代码)
//第一题的答案:
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; i 3; i++)
{
for(int x = i + 1; x 3; x++)
{
System.out.print(" ");
}
for(int y = 0; y (i + 1) * 2 - 1; y++)
{
System.out.print("*");
}
System.out.println();
}
for(int i = 0; i 4; i++)
{
for(int x = 0; x i; x++)
{
System.out.print(" ");
}
for(int y = i; y 2 * 4 - i - 1; y++)
{
System.out.print("*");
}
System.out.println();
}
}
}
java简单的购物车代码
package Test;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
init();//初始化
MapString,String map = new LinkedHashMap();
while(true){
Scanner in= new Scanner(System.in);
map = buy(in,map);//选择
System.out.println();
System.out.println("还要继续购物吗?(Y/N)");
String jx = in.nextLine();
if(jx.equals("N")){
break;
}
}
print(map);
}
public static void print(MapString, String m){
System.out.println("\n\n\n******************");
System.out.println(" 购物车清单");
Integer hj = 0;
for (EntryString, String entry : m.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if(key.equals("1")){
hj += Integer.parseInt(value)*3;
System.out.println("哇哈哈纯净水: "+value+"件,合计:¥"+Integer.parseInt(value)*3);
}else if(key.equals("2")){
hj += Integer.parseInt(value)*5;
System.out.println("康师傅方便面: "+value+"件,合计:¥"+Integer.parseInt(value)*5);
}else if(key.equals("3")){
hj += Integer.parseInt(value)*4;
System.out.println("可口可乐: "+value+"件,合计:¥"+Integer.parseInt(value)*4);
}
}
System.out.println("合计金额:¥"+hj);
}
public static void init(){
System.out.println("******************");
System.out.println("\t商品列表\n");
System.out.println(" 商品名称 价格");
System.out.println("1. 哇哈哈纯净水 ¥3");
System.out.println("2. 康师傅方便面 ¥5");
System.out.println("3. 可口可乐 ¥4");
System.out.println("******************");
}
public static MapString,String buy(Scanner scan,MapString,String m){
System.out.print("请输入编号:");
String bh = scan.nextLine();
System.out.print("请输入购买数量:");
String num = scan.nextLine();
if(m.size()0 m.keySet().contains(bh)){
m.put(bh,(Integer.parseInt(bh)+Integer.parseInt(num))+"");
}else{
m.put(bh, num);
}
return m;
}
}
名称栏目:java购物支付页面代码 java购物支付页面代码是多少
新闻来源:http://ybzwz.com/article/hgcghd.html