Question

In: Computer Science

Using a (GUI interface), write a Java program that simulates an ATM machine with the following...

Using a (GUI interface), write a Java program that simulates an ATM machine with the following options menu:

"Welcome"

1. Deposit to account

2. Withdraw

3. Exit

Solutions

Expert Solution

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
=================================

// AccountTest.java

import javax.swing.JOptionPane;

public class AccountTest {

   public static void main(String[] args) {
       int choice;
       double amt=0.0;
       Account acc=new Account();
       while (true) {
           choice = Integer.parseInt(JOptionPane.showInputDialog("\"Welcome\"\n1.Deposit to account\n2.Withdraw\n3.Exit\nPlease enter the first number: "));
           switch (choice) {
           case 1: {
               amt=Double.parseDouble(JOptionPane.showInputDialog("Enter Amount to despoit:$" ));
           acc.deposit(amt);
           JOptionPane.showMessageDialog(null,"Your New Balance :$"+acc.getBalance());

               continue;
           }
           case 2: {
               amt=Double.parseDouble(JOptionPane.showInputDialog("Enter Amount to withdraw:$" ));
           boolean b=acc.withdraw(amt);
           if(!b)
           {
               JOptionPane.showMessageDialog(null,"Insufficient Funds");   
           }
           else
           {
               JOptionPane.showMessageDialog(null,"Your New Balance :$"+acc.getBalance());
           }
             
              
               continue;
           }
           case 3: {
               break;
           }
           default: {
               JOptionPane.showMessageDialog(null,"** Invalid Choice **");
               continue;
           }

           }
           break;
       }

   }

}


==================================================

Output:

=====================Could you plz rate me well.Thank You


Related Solutions

You will write a program using Python that simulates an Automatic Teller Machine (ATM). For this...
You will write a program using Python that simulates an Automatic Teller Machine (ATM). For this program, your code can have user defined functions (but not required), the program must not call on any external functions or modules to handle any of the input, computational, and output requirements. Requirements: There is a customer with the following credential and can only access the system if the Access Code is correct: • Name: Peter Parker, Access Code: 2222 • When the program...
Write a Java program 1-)write a program that simulates a vending machine, takes input from the...
Write a Java program 1-)write a program that simulates a vending machine, takes input from the user (money), and returns the change to the user. The change means Quarter =   25 cent Dime = 10 cent Nickels = 5 cent Pinneies = 1 cent 2-) What is the output produced by the following code? int result = 11; result /= 2; System.out.println("resu lt is " + result);
Use the below info to create a java program A GUI interface to ensure a user...
Use the below info to create a java program A GUI interface to ensure a user is old enough to play a game. Properly formatted prompts to input name, address, phone number, and age. Remember that name, address, phone number, etc. can be broken out in additional fields. Refer to the tutorial from this week’s Reading Assignment Multiple vs. Single Field Capture for Phone Number Form Input for help with this. Instructions to ensure that the information is displayed back...
Java - Create a program that simulates a slot machine. When the program runs, it should...
Java - Create a program that simulates a slot machine. When the program runs, it should do the following: - Ask the user to enter the amount of money he or she wants to enter into the slot machine. - Instead of displaying images, have the program randomly select a word from the following list: Cherries, Oranges, Plums, Bells, Melons, Bars (To select a word, the program can generate a random number in the range of 0 through 5. If...
in a gui ' in java write a program that draws equal a simple fence with...
in a gui ' in java write a program that draws equal a simple fence with vertical, spaced slats backed by two boards. Behind the fence show a simple house support Make sure the in the und. house is visible between the slats in the fence.
Write a java program that simulates thousands of games and then calculate the probabilities from the...
Write a java program that simulates thousands of games and then calculate the probabilities from the simulation results. Specifically in the game, throw two dice, the possible summations of the results are: 2, 3, ..., 12. You need to use arrays to count the occurrence and store the probabilities of all possible summations. Try to simulate rolling two dice 100, 1000, 10,0000 times, or more if needed. Choose one simulation number so that the probabilities you calculated is within 1%...
3. Write a program that simulates a vending machine.   The user will be prompted to enter...
3. Write a program that simulates a vending machine.   The user will be prompted to enter a number then a letter. As part of the prompt you must display a message to indicate the number and letter, along with the possible choices. That is, what selections will give user which item.   If the user enters a number or a letter that is not valid, then display the message “Bad Entry” and end the program. (100 pts) Selections with messages. 1a...
You are to write a program using Java that will simulate a slot machine with four...
You are to write a program using Java that will simulate a slot machine with four wheels. It will determine the amount of money won for each spin. The four wheels spin and stop showing a value between 0 and 9 inclusive. It costs $2 to play. •You win $500 (but not the $2 you bet) if you get 4 wheels the same. •You win $10 (but not the $2 you bet) if you get exactly 3 of a kind....
Write a program that simulates a vending machine. The machine holds six snack items labeled them...
Write a program that simulates a vending machine. The machine holds six snack items labeled them 1 through 6. The program should initially display a menu of items along with their prices: Vending Machine 1. Roasted Almonds --> $1.25 2. Pretzels --> $1.75 3. Chewing Gum --> $0.90 4. Mints --> $0.75 5. Chocolate bar --> $1.50 6. Cookies --> $2.00 The program then should ask the user to enter the item to purchase along with a sum of money....
Write the program in Java (with a graphical user interface) and have it calculate and display...
Write the program in Java (with a graphical user interface) and have it calculate and display the mortgage payment amount from user input of the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. Allow the user to loop back and enter new data or quit. You need to include Calculate, Reset, and Exit buttons on your GUI. Please insert comments in the program to document the program. Allow the user to enter...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT