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

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...
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 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....
Im trying to get a GUI interface in java where there is four text fields for...
Im trying to get a GUI interface in java where there is four text fields for the first name, last name, department, and phone number of employee in a program. Then also have a radio button below for Gender (Male/Female/Other) and a list for the Title (Mr./Ms./Mrs./Dr./Col./Prof.). At the very bottom of the frame there has to be buttons for printing, submitting and exiting but for whatever reason when I tried it nothing appears in the frame regardless of what...
Write a java console application,. It simulates the vending machine and ask two questions. When you...
Write a java console application,. It simulates the vending machine and ask two questions. When you run your code, it will do following: Computer output: What item you want? User input: Soda If user input is Soda Computer output: How many cans do you want? User input:            3 Computer output: Please pay $3.00. END The vending machine has 3 items for sale: Soda the price is $1.50/can. Computer should ask “How many cans do you want?” Chips, the price is $1.20/bag....
Suppose the interface and the class of stack already implemented, Write application program to ( java)...
Suppose the interface and the class of stack already implemented, Write application program to ( java) 1- insert 100 numbers to the stack                         2- Print the even numbers 3- Print the summation of the odd numbers
write code in java and comment. thanks. the program is about interface . Implement the basics...
write code in java and comment. thanks. the program is about interface . Implement the basics of Fitness and types of Fitness: Aerobic. Implement specific Fitness types such as Swimming, Cycling, Fitness Task: public interface Fitness (10pts) This will be used as a starting point for deriving any specific Fitness type. Every fitness exercise type has one or more muscle group it affects. Therefor a Fitness has the following abstarct method (Note that all methods in an interface are abstract...
This is for a java program. Payroll System Using Inheritance and Polymorphism 1. Implement an interface...
This is for a java program. Payroll System Using Inheritance and Polymorphism 1. Implement an interface called EmployeeInfo with the following constant variables: FACULTY_MONTHLY_SALARY = 6000.00 STAFF_MONTHLY_HOURS_WORKED = 160 2. Implement an abstract class Employee with the following requirements: Attributes last name (String) first name (String) ID number (String) Sex - M or F Birth date - Use the Calendar Java class to create a date object Default argument constructor and argument constructors. Public methods toString - returning a string...
*In JAVA and JavaFX please!! CSE1322 – Assignment 8 – GUI General User Interface Assignment 8...
*In JAVA and JavaFX please!! CSE1322 – Assignment 8 – GUI General User Interface Assignment 8 Objectives • Build a GUI application similar to a calculator. • Create an application that acts as a simple calculator. Create buttons for 0-9 and a text field that displays the concatenation of the current digits as they are clicked. • Add buttons for operators “+”, “-“, “*”, and “/”. • Add a final button for “=” that calculates the computed value with the...
Topic is relates to Java programming! Code using java GUI 2. Create the following controls: a)...
Topic is relates to Java programming! Code using java GUI 2. Create the following controls: a) a TextField b) a Button c) a Text d) a Label 3. create the following container and put them the above controls: a) a VBox controller b) a BorderPane controller c) a GridPane
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT