Okay, so basically I am an idiot and this is my first programming class. I am completely stuck on this program and I have been staring and messing with it for 4 days and cannot get it too work. For some reason I cannot get the variable to return. Someone please help, I am desperate.
import javax.swing.*; public class Program4 { // Class Variables. public static String firstName = ""; public static String lastName = ""; public static double dollars = 0.0; public static boolean isOpened = false; public static boolean isOverdrawn = false; // Replace "CIS Faculty" with your name. private final static String TITLE_BAR = "Program 4 (Me)"; // Class Methods // Add your methods below here. // You should leave the main method below ALONE!! public static void main(String[] args) { showAccount(); // Will show error message about account not open // and will then continue. // Open new account. Give error message if it fails! if (!openAccount("Bill", "Smith", 100.50)) { reportErrorAndBomb("Coding error 1. Open account failed on a new account!"); } showAccount(); // Check that accountOwner works correctly - bomb if not. if (!accountOwner().equals("Bill Smith")) { reportErrorAndBomb("Coding error 2. Call to accountOwner failed."); } if (balance() != 100.50) // Verify balance is correct! { reportErrorAndBomb("Coding error 3. Balance is wrong!"); } // Confirm that I cannot reopen it! if (openAccount("Bogus", "Try", 55.00)) { reportErrorAndBomb("Coding error 4. You allowed an account " + "to be re-opened!"); } deposit(50.00); showAccount(); if (balance() != 150.50) { reportErrorAndBomb("Coding error 5. Balance is wrong!"); } if (isNowOverdrawn()) { reportErrorAndBomb("Coding error 6. Reports overdrawn when it should not."); } // Confirm correct workings of approveCheckFor method. if (approveCheckFor(150.51)) { reportErrorAndBomb("Coding error 7. Approved a check for too much."); } if (!approveCheckFor(150.50)) { reportErrorAndBomb("Coding error 8. Failed to approve a check " + "for a good amount!"); } withdraw(25.00); if (balance() != 125.50) { reportErrorAndBomb("Coding error 9. Balance is wrong!"); } withdraw(125.75); if (balance() != -0.25) { reportErrorAndBomb("Coding error 10. Balance is wrong!"); } showAccount(); // Should show a deficit of 25 cents. // and that account is now overdrawn. if (!isNowOverdrawn()) { reportErrorAndBomb("Coding error 11. Should respond as overdrawn now."); } // Well... if you made no calls above to reportErrorAndBomb it might not // be working... so let us end the program with its use. reportErrorAndBomb("No Errors reported after testing all methods. " + "\nThis tests reportErrorAndBomb. \nTesting complete with no errors!"); } // main private static void withdraw(double cash) { if (dollars >= cash) dollars -= cash; else ; } private static boolean openAccount(String name, String name2, double funds) { if (firstName.equals(name) & (lastName.equals(name2))) { return true; } if (dollars >= 0 && !isOpened) { return true; } else return false; } private static boolean approveCheckFor(double check) { if (dollars >= check) return true; else return false; } private static boolean isNowOverdrawn() { if (dollars < 0.0); return isOverdrawn; } private static void deposit(double amount) { dollars += amount; } private static double balance() { return dollars; } private static void reportErrorAndBomb(String message) { JOptionPane.showMessageDialog(null, message, TITLE_BAR, JOptionPane.ERROR_MESSAGE); System.exit(0); } private static String accountOwner() { return firstName + lastName; } private static void showAccount() { boolean accountOwner = true; String.format("%.2f", dollars); if (!isOpened && !accountOwner) JOptionPane.showMessageDialog(null, "Account Owner: " + firstName + lastName + "\n" + "Account Balance: " + dollars + "\n" + "Account Overdrawn: " + isOverdrawn); else JOptionPane.showMessageDialog(null, "You have attempted to display an accont which is not " + "opened yet. ", TITLE_BAR, JOptionPane.ERROR_MESSAGE); } } // Program4