
正文
支付结算java代码 java支付模块如何实现
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
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
相关问答
Q1: 怎么用JAVA编译升级购物结算? 有商品名称、商品金额、继续购买的循环、折扣、总计金额、交费金额、找钱
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import org.apache.commons.lang.StringUtils;
public class Test
{
public static void main(String []args){
System.out.println("******************************************************************************************************");
System.out.println("请选择要购买支付结算java代码的商品编号:");
System.out.println("1.T恤(245) 2.网球鞋(570) 3.网球拍(320)");
System.out.println("******************************************************************************************************");
Long total = 0L;
//应付费用和找零保留两位小数点
DecimalFormat df = new DecimalFormat("#.00");
BufferedReader strin=new BufferedReader(new InputStreamReader(System.in));
//接受用户输入的变量支付结算java代码,商品编码、商品数量、是否继续和实际交费
String code = "";String num = "";String isBuy = "";String pay = "";
Double discount = 0.8;
int number = 0;Long payMoney = 0L;Boolean flag = false;
try
{
//do...while循环支付结算java代码,先执行do支付结算java代码,然后在用户输入y的情况下循环执行do中的语句
do{
code ="";num="";isBuy="";
//如果输入编号有误则循环重新输入
do{
flag=false;
System.out.print("请输入商品编号:"+code);
//获取用户输入的编码
code = strin.readLine();
if(code.equals("1")||code.equals("2")||code.equals("3")){
flag = true;
}else{
flag=false;
System.out.print("商品编号不存在支付结算java代码!");
}
}while(flag == false);
//输入不符合要求时循环重新输入
do{
flag = false;
System.out.print("请输入商品数量:"+num);
//获取用户输入的数量
num = strin.readLine();
//在输入数量不为空的情况下,将数量转换成整型,若转换失败说明输入的不是整型数据,提示用户重新输入
if(StringUtils.isNotEmpty(num)){
try
{
number = Integer.parseInt(num);
flag = true;
}
catch (Exception e)
{
System.out.println("商品数量请输入正整数!");
flag = false;
num = "";
}
}
}while(flag == false);
//根据用户输入情况计算当前费用
if(code.equals("1")){
total += 245*number;
System.out.println("T恤 ¥"+245.0 +" ¥"+total);
System.out.print("是否继续(y/n)"+isBuy);
isBuy = strin.readLine();
}else if(code.equals("2")){
total+=570*number;
System.out.println("网球鞋 ¥"+570.0 +" ¥"+total);
System.out.print("是否继续(y/n)"+isBuy);
isBuy = strin.readLine();
}else if(code.equals("3")){
total+=361*number;
System.out.println("网球拍 ¥"+320.0 +" ¥"+total);
System.out.print("是否继续(y/n)"+isBuy);
isBuy = strin.readLine();
}
}while(isBuy.equals("y"));
System.out.println("折扣:"+discount);
//根据折扣计算顾客需要交纳的费用
String needPay = df.format(total*discount);
System.out.println("金额总计: ¥"+needPay);
//输入不符合要求时循环重新输入
do{
flag =false;
System.out.print("实际交费: ¥"+pay);
//获取用户输入的实际交费
pay = strin.readLine();
//在输入交费不为空的情况下,将交费转换成长整型,若转换失败说明输入的不是长整型数据,提示用户重新输入
if(StringUtils.isNotEmpty(pay)){
try{
payMoney = Long.parseLong(pay);
flag=true;
}catch(Exception ex){
System.out.println("实际交费请输入数字!");
flag=false;
pay="";
}
}
}while(flag == false);
System.out.print("找钱: ¥"+(payMoney-Double.parseDouble(needPay)));
}catch (IOException e1){
e1.printStackTrace();
}
}
}
以上是能达到输出要求的代码,有通过测试,比较初级的,希望能帮到楼主。
Q2: 用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代码和java支付模块如何实现的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。







