用Java制作一个微信零钱充值和提现的简易系统①

0

用Java制作一个微信零钱充值和提现的简易系统①

微信零钱充值和提现系统简易实现

系统概述本系统旨在实现微信零钱的充值和提现功能,提供一个简单易用的界面,让用户能够快速完成相关操作。

系统流程图```markdown+---------------+

| 用户登录 |

+---------------+

|

|

v+---------------+

| 登录成功 |

| 显示充值/提现|

+---------------+

|

| (1) 充值操作 v+---------------+

| 充值金额输入 |

+---------------+

|

| (2) 提现操作 v+---------------+

| 提现金额输入 |

+---------------+

|

| (3) 支付密码验证 v+---------------+

| 支付密码正确 |

| 充值/提现成功|

+---------------+

|

| (4) 支付密码错误 v+---------------+

| 支付密码错误 |

| 提示输入支付密码|

+---------------+

```

Java代码实现 User.java

```javapublic class User {

private String username;

private String password;

public User(String username, String password) {

this.username = username;

this.password = password;

}

public String getUsername() {

return username;

}

public void setUsername(String username) {

this.username = username;

}

public String getPassword() {

return password;

}

public void setPassword(String password) {

this.password = password;

}

}

```

Recharge.java

```javapublic class Recharge {

private double amount;

public Recharge(double amount) {

this.amount = amount;

}

public double getAmount() {

return amount;

}

public void setAmount(double amount) {

this.amount = amount;

}

}

```

Withdraw.java

```javapublic class Withdraw {

private double amount;

public Withdraw(double amount) {

this.amount = amount;

}

public double getAmount() {

return amount;

}

public void setAmount(double amount) {

this.amount = amount;

}

}

```

PayPassword.java

```javapublic class PayPassword {

private String password;

public PayPassword(String password) {

this.password = password;

}

public String getPassword() {

return password;

}

public void setPassword(String password) {

this.password = password;

}

}

```

Main.java

```javaimport java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.println("请输入用户名:");

String username = scanner.nextLine();

System.out.println("请输入密码:");

String password = scanner.nextLine();

User user = new User(username, password);

while (true) {

System.out.println("请选择操作:");

System.out.println("1. 充值");

System.out.println("2. 提现");

int choice = Integer.parseInt(scanner.nextLine());

switch (choice) {

case1:

Recharge recharge = new Recharge(0);

System.out.println("请输入充值金额:");

recharge.setAmount(Double.parseDouble(scanner.nextLine()));

PayPassword payPassword = new PayPassword("");

System.out.println("请输入支付密码:");

payPassword.setPassword(scanner.nextLine());

if (payPassword.getPassword().equals(user.getPassword())) {

System.out.println("充值成功!");

} else {

System.out.println("支付密码错误!");

}

break;

case2:

Withdraw withdraw = new Withdraw(0);

System.out.println("请输入提现金额:");

withdraw.setAmount(Double.parseDouble(scanner.nextLine()));

PayPassword payPassword1 = new PayPassword("");

System.out.println("请输入支付密码:");

payPassword1.setPassword(scanner.nextLine());

if (payPassword1.getPassword().equals(user.getPassword())) {

System.out.println("提现成功!");

} else {

System.out.println("支付密码错误!");

}

break;

default:

System.out.println("请选择正确的操作!");

}

}

}

}

```

后续改进* 在输入支付密码错误的时候,提供用户选择忘记密码这一操作,通过身份验证修改支付密码。

* 提供更多的功能,如查看余额、历史记录等。

以上是微信零钱充值和提现系统的简易实现。后续还会继续改进和完善这个系统。

java开发语言

版权声明:除非特别标注,否则均为网络文章,侵权请联系站长删除。

上一篇 Django整合微信h5支付

下一篇 传奇网关-微信绑定和充值