Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need UML for my code please import java.util.Scanner; public class atm { static Scanner input = new Scanner(System.in); public static void main(String args[] )

I need UML for my code please

import java.util.Scanner;

public class atm { static Scanner input = new Scanner(System.in); public static void main(String args[] ) { int balance = 5000; //simulating the ATM while(true) { //show the available possible options showMenu(); int n = input.nextInt(); switch(n) { case 1: //withdraw from ATM balance = withdrawMoney(balance); break;

case 2: //balance check System.out.println("Available Balance: $"+balance); break; case 4: input.close(); System.exit(0); default: System.out.println("Invalid selection. Please try again!!"); } System.out.println(" "); } }

/** * Method to show the possible options in the menu */ private static void showMenu() { System.out.println("atm test"); System.out.println("Enter 1 to Withdraw Money, and 2 Check Balance"); System.out.print("Enter your choice: "); } /** Method to withdraw the amount */ private static int withdrawMoney(int balance) { System.out.print("Enter money to be withdrawn: $"); int withdraw = input.nextInt(); //check sufficient balance available if(balance >= withdraw) { balance -= withdraw; System.out.println("Please collect your money"); } else System.out.println("Insufficient Balance"); return balance; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

what is a peer Group? Importance?

Answered: 1 week ago

Question

=+C&B (especially taxation) laws, regulations, and practices?

Answered: 1 week ago

Question

=+designing international assignment C&B packages.

Answered: 1 week ago