hange this code to JAVA GUI (FX OR SWING)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Change this code to JAVA GUI (FX OR SWING)

 

eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8


import java.util.Scanner;

public class BankingApplication {

public static void main(String[] args) {

BankAccount obj = new BankAccount("SL DevCode", "SL00001");
obj.showMenu();

}

}

class BankAccount{
int balance;
int previousTransaction;
String customerName;
String customerId;

BankAccount(String cname , String cid) {
customerName = cname;
customerId = cid;
}


void deposit(int amount) {
if(amount != 0) {
balance = balance + amount;
previousTransaction = amount;
}
}

void withdraw(int amount) {
if(amount != 0) {
balance = balance - amount;
previousTransaction = -amount;
}
}

void getPreviousTransaction() {
if(previousTransaction > 0) {
System.out.println("Deposited: " + previousTransaction);
}
else if(previousTransaction < 0) {
System.out.println("Withdraw: " +Math.abs(previousTransaction));
}

else {
System.out.println("No Transaction Occured");
}
}

void showMenu() {

char option = '\0';
Scanner scanner = new Scanner(System.in);

System.out.println("Welcome " +customerName);
System.out.println("Your ID is " +customerId);
System.out.println("\n");

System.out.println("A : Check Your Balance");
System.out.println("B : Deposit");
System.out.println("C : Withdraw");
System.out.println("D : Previous Transaction");
System.out.println("E : Exit The System");

do {
System.out.println("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=");
System.out.println("Enter Your Option");
System.out.println("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=");
option = scanner.next().charAt(0);
System.out.println("\n");

switch (option) {

case 'A':
System.out.println("-------------------------------------------------------");
System.out.println("Balance = "+balance);
System.out.println("-------------------------------------------------------");
System.out.println("\n");
break;

case 'B':
System.out.println("-------------------------------------------------------");
System.out.println("Enter an amount to deposit ");
System.out.println("-------------------------------------------------------");

int amount = scanner.nextInt();
deposit(amount);
System.out.println("\n");
break;

case 'C':
System.out.println("-------------------------------------------------------");
System.out.println("Enter an amount to withdraw ");
System.out.println("-------------------------------------------------------");

int amount2 = scanner.nextInt();
withdraw(amount2);
System.out.println("\n");
break;

case 'D':
System.out.println("-------------------------------------------------------");
getPreviousTransaction();
System.out.println("-------------------------------------------------------");
System.out.println("\n");
break;

case 'E' :
System.out.println("=========================================================================================================");
break;

default:
System.out.println("Invalid Option!! Please Enter Correct Opton...");
break;
}
}
while(option != 'E');
System.out.println("Thank You for Using our Services.....!!");
}
}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Form and its Elements
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education