Home Answers Viewqa Java-Beginners hello there i need help

 
 


Mariwaya Hassin
hello there i need help
2 Answer(s)      a year and 4 months ago
Posted in : Java Beginners

: i need to do a program like this:

Automatic Teller Machine [B] Balance [D] Deposit [W] Withdrawal [Q] Quit select you OPtions:

once i have chosen an option then i should proceed here

if i choose b:

YOur Balance is __

if i chose D:

Enter you deposit amount:


if i choose W:

Enter the Withdrawal amount:


(if balance is >= withdrwal display transaction, if balance is < withdrawal display "insufficient Amount"

every after each of the choices a window like this should come out:

Would you Like to generate bank slip? YES NO

if yes: for balance:

BALANCE INQUIRY AMOUNT BALANCE:


Printing bank slip....

for deposit: DEPOSIT AMOUNT:_ printing book slip:

for withdrawal: your withdrwal amount:


if no: it will return to: Would you like another transaction?

thats the problem. I dont know how to start this program because i am a beginner, and aside from that i am really eager to learn java please help me with the codes and please explain to me how it works. i only need to use if else statements and do while beacause it is the lesson we are in to, please help m,e

View Answers

January 14, 2012 at 5:44 PM


import java.util.*;

class ATM{
        static Scanner input = new Scanner(System.in);
        String name, actype;
        int accNo, bal, amt;

        ATM(String name, int accNo, String actype, int bal) {
                this.name = name;
                this.accNo = accNo;
                this.actype = actype;
                this.bal = bal;
        }

        int deposit(){
                System.out.print("Enter amount to deposit:");
                amt = input.nextInt();
                if (amt < 0) {
                        System.out.println("Invalid Amount");
                        return 1;
                }
                bal = bal + amt;
                return 0;
        }
        int withdraw(){
                System.out.println("Your Balance=" + bal);
                System.out.print("Enter amount to withdraw:");
                amt = input.nextInt();
                if (bal < amt) {
                        System.out.println("Not sufficient balance.");
                        return 1;
                }
                if(amt < 0) {
                        System.out.println("Invalid Amount");
                        return 1;
                }
                bal = bal - amt;
                return 0;
        }
        void display(){
                System.out.println("Name:" + name);
                System.out.println("Account No:" + accNo);
                System.out.println("Balance:" + bal);

        }
        void dbal() {
                System.out.println("Balance:" + bal);
        }
        public static void main(String args[]){
                System.out.println("Enter your Name: ");
                String nn = input.nextLine();
                System.out.println("Enter Account Number: ");
                int num = input.nextInt();
                System.out.println("Enter Account Type: ");
                String type = input.next();
                System.out.println("Enter Initial Balance: ");
                int bal = input.nextInt();
                ATM b1 = new ATM(nn, num, type, bal);
                int menu;
                System.out.println("Menu");
                System.out.println("B. Balance");
                System.out.println("D. Deposit");
                System.out.println("W. Withdraw ");
                System.out.println("Q. Quit");
                boolean quit = false;
                do{
                     System.out.print("Please enter your choice: ");
                     menu = input.nextInt();
                        switch(menu) {
                        case 1:
                                b1.display();
                                break;

                        case 2:
                                b1.deposit();
                                break;

                        case 3:
                                b1.withdraw();
                                break;

                        case 4:
                                quit = true;
                                break;
                        }
                }
                while (!quit);
        }
}

January 14, 2012 at 5:50 PM


import java.util.*;

class ATM{
        static Scanner input = new Scanner(System.in);
        String name, actype;
        int accNo, bal, amt;

        ATM(String name, int accNo, String actype, int bal) {
                this.name = name;
                this.accNo = accNo;
                this.actype = actype;
                this.bal = bal;
        }

        int deposit(){
                System.out.print("Enter amount to deposit:");
                amt = input.nextInt();
                if (amt < 0) {
                        System.out.println("Invalid Amount");
                        return 1;
                }
                bal = bal + amt;
                return 0;
        }
        int withdraw(){
                System.out.println("Your Balance=" + bal);
                System.out.print("Enter amount to withdraw:");
                amt = input.nextInt();
                if (bal < amt) {
                        System.out.println("Not sufficient balance.");
                        return 1;
                }
                if(amt < 0) {
                        System.out.println("Invalid Amount");
                        return 1;
                }
                bal = bal - amt;
                return 0;
        }
        void display(){
                System.out.println("Name:" + name);
                System.out.println("Account No:" + accNo);
                System.out.println("Balance:" + bal);

        }
        void dbal() {
                System.out.println("Balance:" + bal);
        }
        public static void main(String args[]){
                System.out.println("Enter your Name: ");
                String nn = input.nextLine();
                System.out.println("Enter Account Number: ");
                int num = input.nextInt();
                System.out.println("Enter Account Type: ");
                String type = input.next();
                System.out.println("Enter Initial Balance: ");
                int bal = input.nextInt();
                ATM b1 = new ATM(nn, num, type, bal);
                String menu;
                System.out.println("Menu");
                System.out.println("B. Balance");
                System.out.println("D. Deposit");
                System.out.println("W. Withdraw ");
                System.out.println("Q. Quit");
                boolean quit = false;
                do{
                     System.out.print("Please enter your choice: ");
                     menu = input.next();
                     char choice=menu.charAt(0);
                        switch(choice) {
                        case 'B':
                                b1.display();
                                break;

                        case 'D':
                                b1.deposit();
                                break;

                        case 'W':
                                b1.withdraw();
                                break;

                        case 'Q':
                                quit = true;
                                break;
                        }
                }
                while (!quit);
        }
}









Related Pages:
hello there i need help
hello there i need help  : i need to do a program like... i am a beginner, and aside from that i am really eager to learn java please help me with the codes and please explain to me how it works. i only need to use
i need help - Development process
i need help  hello, i need help regarding this program. this program... IPAddress on command line, but i want to take it dynamically and it must store...?   hi subhash hope this code can help you, public class PingTest
i need help - Development process
i need help  hello, i need help regarding this program. public...()); } } } it is printing the result of ping in to a file,but if i want... the result in to the files,if i want to do this i must make my program running
Need help
Need help  Hello... I need some help I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name.. for example.. i have a method name() which
Need help
Need help  Hello... I need some help I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name.. for example.. i have a method name() which
i need a help in this please
i need a help in this please  The factorial of a nonnegative integer n is written n! (pronounced â?? n factorialâ??) and is defined as follows: n!=n...=input.nextInt(); long num=m; for(int i=m;i>1;i
I have need to help
I have need to help  Write a program that, for four points A, B, C and P, draws a triangle formed by ABC and a small cross showing the position of P; and displays a line of text indicating which of the following three cases
Need help with nested queries
Need help with nested queries  Hello, Table1 has "id", "votes" columns. Table2 has "id", "Name" column. I need to retrieve Name and its corresponging Votes. I tried with nested queries but its confusing. Can anyone please help
Need Help - Java Beginners
Need Help  Hello Sir, Am a beginner of Java. Also i did course on J2EE... but dont have any ideas about real time projects. But i want to do some projects in Java as well as J2EE... Can u help me and guide to do a project
Need Help on the script
Need Help on the script  hello there, My name is Femi and am a web developer using php. am working on a project. and am having some difficulties. i dont know if you can help me out with it. The platform am building will receive
Need help in java programming
Need help in java programming  Hello. Can someone please help me... StudentResult[2]; for (int i=0; i<data.length; i++) { int j=i+1...; System.out.println("Total Marks="+tm); data[i] = new
i need help to solve this problem
i need help to solve this problem  Write a stack class ArrayStack.java implements PureStack interface that reads in strings from standard input.... H and I join the queue h. G leaves the queue i. H and I leave the queue
i need help plz .... Quickly
i need help plz .... Quickly   how can i count how many numbers enterd by the user so the output would be like this Total number of Scores = .... this is my code :- import java.util.Scanner; public class SCORES { public
Need help
Need help  Dear sir, I have a problem. How to write JSP coding, if a user select a value from drop down list for example department, the another drop.... This name list should get from the database. Please help me. By the way, I'm
Need help with this!
Need help with this!  Can anyone please help me... to effectivly end the loop with out the need to break it. for(i=(0); i <... to a file at all at this time. Any help would be greatly appreciated, thank you
need
need  i need a jsp coding based project plz help me
pls i need help with my assignment
pls i need help with my assignment  how to write a code that ask the user for the height of the triangle and prints the triangle using * eg if height is 3 it prints * and also using import java.util.Scanner
need
need  hello anybody can write a javascript program for the capturing...-ordinates of x and y(i mean specified x and y cordinates)which can i mention it???? simply i mean to say capturing the user click in my webpage anywhere
need
need  hello anybody can write a javascript program for the capturing...-ordinates of x and y(i mean specified x and y cordinates)which can i mention it???? simply i mean to say capturing the user click in my webpage anywhere
PLZ HELP ME. i need php code.
PLZ HELP ME. i need php code.   I want php code for bellow OUTPUT. output is just example but it must be letters only. abc bcd efg jku rgt azs hje qqc wws adt
Hello
Hello  Hello sir i want to store upload doc file in ms access by using servlet. Can i store file in access.one another things access only text size is 255 character but my file is up to 2mb how i can store
I need your help - Java Beginners
I need your help  What is the purpose of garbage collection in Java, and when is it used?  Hi check out this url : http://www.artima.com/insidejvm/ed2/gc.html http://java.sun.com/javase/technologies/hotspot
i need some help in understanding the following codes.thanks..
i need some help in understanding the following codes.thanks..  this code is to perform LocalColorHistogram.But i can't understand it public... * height; int i = 0; int j = 0; int k = 0; double
hello
hello  what is the code for adding groups in contacts using servlet and jsp???pls help me
need help pleaseee....i weak in java
need help pleaseee....i weak in java  QUESTION 1 You are required to write an application called Customer Billing System. This system...) Separate them as either R/r for Residential or I/i for Industrial. You can use
hello
hello  i have to write a program that stores vowels (a,e,i,o and u... character is vowel or not.   Hello Friend, Try the following code...) { char charr[]={'a','e','i','o','u'}; Scanner input=new
i need your help - Java Interview Questions
i need your help  Write a java program that: i. Allows user to enter 2 numbers from the keyboard ii. Uses a method to compare the two numbers to determine which is larger iii. Print to the screen stating which number is larger
I need help in doing this. - Java Beginners
I need help in doing this.  Student DataBase i will need creating..., and the student's GPA.using arrays and objects, need to structure the information... objects that will house the birthdates for each student member. (I have
hello
hello  tq so much 4 helping me...i really appreciate it... :)... i've..."); } System.out.println ("Total monthly bill \n" + payrate); } } i think there is so many error...please try check it out..   Hello Friend, We have
hello
hello  i have to write a program in swings so that the program could exhibit the use of shortcut keys like ctrl+s. and another one is that i have to create an applet with a button labelled "who's number one" and whenever i click
I need your help - Java Beginners
I need your help  For this one I need to create delivery class for a delivery service .however, this class should contain (delivery number which contains eight digits. The first four digits represent the year; the last four
need help on writing a program. - Java Beginners
Writing first Java Program  Hi, I need help to write my first Java Program other then Hello World! Thanks!!  Hi Thanks for choosing roseIndia to get your query solved. check given link to see the solution of your Java
Need Help in Java programming
Need Help in Java programming  Hello. Can someone please help me with writing the following program Java program that gives assignment details such as:assignment number,assignment name,due date,submission date,percentage marks
Need Help on JMS - JMS
Need Help on JMS   Hi, In my application i need to create my own ques and my own QueueConnectionFactory..... Plz tell me how to create the same... Any help is appriciated,.. Thanks in advance
need help please
need help please  Dear sir, my name is logeswaran. I have a big problem that I can't find the solution for a program. How can I block a user from enter a page second time. Please help me. By the way I'm using Access database
need help to create applet
need help to create applet  Can u help me..?? I get a task ...and i dont know how to make it... So I hope that u can help me... Here is the task... If u can help me, then please send it to my email lcfahmi90@yahoo.com http
Need help on JAVA JSP
Need help on JAVA JSP  Hi, I have never worked on java and I have been given an assignment where I have to fix existing issues in the tool(created...(need to know how I can adjust it based on the cureen system's screen resolution
Need some help urgently
Need some help urgently  Can someone please help me with this below question. I need to write a class for this. If you roll Y standard six-sided dice... about the probability of coming X or more number of 4's on Y number of dice. I
need help - Java Beginners
need help  Need help in programming in Java  Simple java...();DISPLAYING OUPUT " * " ," *** " ........I used System.out.print('"'); statement before System.out.print("*"); statement and I used
Need help - Java Beginners
Need help   To Write a Java program that asks the users to enter a m...; Hi Friend, Please try the following code. We hope that this code will help...[]) { int[][] arr = new int[4][4]; for (int i = 0; i <
Need help with my project
Need help with my project  Uses a while loop to perform the following...)); bw.newLine(); for(int i=firstNum;i<=secondNum;i++){ sum+=i; if((i%2)!=0){ bw.write
i need latest oracle certified java dumps.. Pleas help me?
i need latest oracle certified java dumps.. Pleas help me?  i need latest oracle certified java dumps.. Pleas help me
need help...................please
need help...................please  I have a problem in my JSP Coding. How to retrive value from database in to text field when user select one value... on this area. Please help me. By the way, I'm using access Database and JSP coding
I need to develop a gui like this
please help me   sorry goes through this link I need to develop like...I need to develop a gui like this  Hai Friends, I need to develop such a menu in my gui programs. The gui contains 1 text field.whenever the text
( Inheritance, Polymorphism, Overriding)i need help - Java Beginners
( Inheritance, Polymorphism, Overriding)i need help  Advanced Concepts with Classes( Inheritance, Polymorphism, Overriding) i need help to create this application,than you Employees in a company are divided into the classes
need help with a program - Java Beginners
need help with a program   Part I An algorithm describes how... by the user. The output of the program should be the length and width (entered.... First you would need to make up the "test data". For this algorithm, the test data
HELP
HELP  I need this code to open in a new web browser. but no matter what i do it wont please help?? Directive 055 Storage Requirements for the Upstream Petroleum Industry
need someone to do/help with code
need someone to do/help with code  i need someone to do a code for me..., I want a second class that is able to tell the owner how much he made that day, along with the number of items sold..please help did a code 500 times cant
help
help  i need help with this code. write a java code for a method named addSevenToKthElement that takes an integer array, and an integer k as its arguments and returns the kth element plus 7. any help would be greatly
Need urgent help with C++ errors!
Need urgent help with C++ errors!  hi, i'm new to C++ programming. this is my code... i'm using Turbo C++. It's showing so many errors!.. I don't know what to do. Please help!! #include<iostream.h> void main

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.