我正在用Java编写兴趣计算器.程序提示用户输入,并使用该输入计算某个银行帐户的利息(检查,储蓄或CD).
这是我的程序的要点,它非常简单.但是现在我很难理解为什么return语句在createAccount方法中不起作用.任何帮助,将不胜感激.
Banker.java:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Banker {
// Array for type of bank account
public static void createAndShowGUI() {
// Declare strings for period, balance, rate
String period;
String balance;
String rate;
String type;
String input;
// Prompt for account type
String[] accttype = {"Checking", "Savings", "CD"}; // Array of bank acct types
input = (String) JOptionPane.showInputDialog(null, "Choose account...",
"Choose bank account type", JOptionPane.QUESTION_MESSAGE, null,
accttype, // Array of acct types
accttype[0]); // First …
Run Code Online (Sandbox Code Playgroud)