java支付小程序源代码 java支付小程序源代码怎么用
求一个java applet小程序的源代码
import java.applet.Applet;
成都创新互联专注于企业网络营销推广、网站重做改版、常山网站定制设计、自适应品牌网站建设、HTML5、商城网站建设、集团公司官网建设、成都外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为常山等各大城市提供网站开发制作服务。
import java.awt.Button;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.TextField;
import java.awt.event.ActionEvent;
public class Nicki extends Applet{
private static final long serialVersionUID = 1L;
private Button ok;
private int num=32;
private int resu=0;
private boolean isRig=false;
private TextField iPut;
public Nicki(){
this.setLayout(null);
ok=new Button("OK");
ok.setActionCommand(getName());
ok.setBounds(150, 150, 40, 20);
iPut=new TextField();
this.add(iPut);
iPut.setBounds(100, 150, 40, 20);
this.add(ok);
ok.addActionListener(new ButtonAction(this));
}
public void paint(Graphics g){
g.setColor(Color.white);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
g.setColor(Color.BLACK);
g.drawString("Please guess a number ", 10, 20);
g.drawString("between 1 and 100", 10, 40);
if(isRig==falseresu!=0){
if(resunum){
g.drawString(""+resu+" is too big !", 10, 100);
}else if(resunum){
g.drawString(resu+"is too small !", 10, 100);
}
}else if(isRig==true){
g.setColor(Color.GREEN);
g.drawString("Yes,"+resu+" is the right number", 10, 80);
g.drawString("Your are great! ", 10, 100);
g.setColor(Color.red);
g.drawString(resu+"!", 70, 120);
}
iPut.setText("");
g.drawString("Input the number:", 0, 150);
}
public void ButtonActionPerformed(ActionEvent e){
if(e.getActionCommand().equals("panel0")){
resu=Integer.parseInt(iPut.getText());
if(num==resu){
isRig=true;
}else{
isRig=false;
}
repaint();
}
}
}
class ButtonAction implements java.awt.event.ActionListener{
Nicki su;
public ButtonAction(Nicki bun){
this.su=bun;
}
public void actionPerformed(ActionEvent e) {
su.ButtonActionPerformed(e);
}
}
Java 小程序
import java.util.Scanner;
public class next {
public static void main(String[] args) {
System.out.print("请依次输入贷款总额,月利率,年数");
Scanner sc = new Scanner(System.in);
double dkze = sc.nextDouble();
double ylv = sc.nextDouble();
double ns = sc.nextDouble();
next nx = new next();
nx.jisuan(dkze,ylv,ns);
}
public void jisuan(double dkze,double ylv,double ns) {
double yzfje = 0;
yzfje = (dkze*ylv/100)/(1-1/Math.pow(1+ylv,ns*12));
System.out.println("月支付金额为:"+yzfje);
}
}
谁能给个JAVA的小程序代码,越小越好!
这是我晓得的最简单的java小程序代码了你可以看看:
package com.kenki.emp;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.SQLException;
import java.sql.*;
public class emp extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK";
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String code = request.getParameter("code");
String name = request.getParameter("name");
String pay = request.getParameter("pay");
System.out.println("empcode:" + code);
System.out.println("name:" + name);
System.out.println("pay:" + pay);
//创建驱动
new com.microsoft.jdbc.sqlserver.SQLServerDriver();
String strd =
"jdbc:microsoft:sqlserver://localhost:1433;databasename=emp_dates";
String username = "sa";
String pws = "";
try {
java.sql.Connection conn = java.sql.DriverManager.getConnection(
strd, username, pws);
String strs = "insert into emp values(?,?,?)";
java.sql.PreparedStatement pre = conn.prepareStatement(strs);
pre.setString(1, code);
pre.setString(2, name);
pre.setString(3, pay);
pre.execute();
pre.close();
conn.close();
//重定向至查询页面
out.println("成功保存!!");
response.sendRedirect("emp.html");
} catch (SQLException ss) {
ss.printStackTrace();
response.sendRedirect("/WebModule1/error.html");
}
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doGet(request, response);
}
//Clean up resources
public void destroy() {
}
}
文章题目:java支付小程序源代码 java支付小程序源代码怎么用
网页URL:http://cdiso.cn/article/doeccis.html