Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


Ashish Chaudhary
ATM Logic
1 Answer(s)      3 years and 10 months ago
Posted in : Java Beginners


Q-In an ATM program i want to print the receipt in which there is information of rupees note that come out from an ATM machine when user enters the particular amount.
For e.g. if user enters 2250 then he should get receipt in this format
1000*1=1000
500*2=1000
100*2=200
50*1=50
Total=2250
Note: The ATM should check for particular rupee note whether it is available or not
if in above example 100 rupee note is not found then the program takes 50 rupee note and so on.


PLEASE GIVE ME THE CODE FOR THIS.
AshishChaudhary
ashish.mercian@gmail.com

Advertisement
View Answers

June 19, 2010 at 1:03 PM


Hi Friend,

Try the following link:

import java.util.*;

class CashDispenser {
public static void main(String[]args){
Scanner input=new Scanner(System.in);
System.out.println("Enter Amount: ");
int amount=input.nextInt();
int[] rupees = {1000,500,100,50};
int[] count = {0,0,0,0};

for(int i=0;i<rupees.length;i++){
if(rupees[i]<amount || rupees[i]==amount){
count[i]=amount/rupees[i];
amount=amount%rupees[i];
}
}
for(int i=0;i<count.length;i++){
if(count[i]!=0){
System.out.println(rupees[i]+" * "+count[i]+" = "+(rupees[i]*count[i]));
}
}
}
}

Hope that it will be helpful for you.
Thanks


Related Tutorials/Questions & Answers:
ATM Logic - Java Beginners
ATM Logic   Q-In an ATM program i want to print the receipt in which there is information of rupees note that come out from an ATM machine when user... Note: The ATM should check for particular rupee note whether it is available
ATM
Advertisements
atm machine code - Framework
atm machine code  plz send me the code of atm machine in c#.reply
ATM IN JAVA RMI - RMI
ATM IN JAVA RMI  How to write code for ATM using Java RMI
ATM machine in c#
ATM machine in c#  i am looking for a code that will be able to create an account and be able to log-in to the atm machine
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
atm code in servlet& jsp
atm code in servlet& jsp  pls send me the code of ATM project in servlet jsp . my requirements are first of all an user login window open then balance enquiry, withdraw of money, money transfer, then log out. pls send as early
Simple ATM Java Code...
Simple ATM Java Code...  You are required to write a Graphical User Interface that simulates an ATM by building on the program you wrote... list, following which your ATM becomes operational for use by your customers
code for ATM - Java Beginners
code for ATM  How to write code for ATM?  can you plz... javax.swing.event.*; public class ATM extends Applet { public void init... { // setting up a pin that is needed for the atm private
ATM Java Code - Java Beginners
ATM Java Code  how to write ATM code that requirement is 1)user can insert name, account number, current balance,transaction type, 2)if select transaction is money deposit, the value will be input and current balance
Auto Teller Machine Emulator : (ATM Emulator)
Auto Teller Machine Emulator : (ATM Emulator)  following functionalities : a) Create an ATM cash deliver emulator application that will have... as input through ATM machine and give the cash amount. ATM machine has
Logic and desgin
Logic and desgin  How would this be put in visual logic symbol
atm java program - Java Interview Questions
atm java program  i need an atm system program java code that requires a user to enter his pin.then after entering the pin,it will ask again the user to select from 3 choices such as [1]Inquiry [2]Withdraw [3]Deposit.then if he
Logic Building
Logic Building  I wanted to devlop my logic ? How can i do so ? Can i start with java or i need to do c++ before
Logic Iterate.
Logic Iterate.  I have one doubt about logic:iterate. I use text feild inside of logic:iterate , there is possible will generate N no of rows (text feild) inside of iterate. my doubt is how to get the Paritcular rows text
Logic Iterate.
Logic Iterate.  logic iterate Struts I have one doubt about logic:iterate. I use text field inside of logic:iterate , there is possible... the Particular rows text value. for example: print("<logic:iterate id="xid
Logic and Degin
Logic and Degin  Need help in writing a pseudocode for this can so please help me with this just need to get started. In this lab, you are going to extend the Fireworks Checkout Stand application in Week 6. This week, we
Logic and Design
Logic and Design  Please help me with this Write a program that prompts and accepts a number between 1 and 12. After getting the input, display the number with the appropriate month. (example: This is the 1st month¦January
logic-iterate
logic-iterate  in my code i am using for-each loop for displaying data i want use tag to display data how to use plase help me <%@ page import="java.sql.*" %> <%String[] id = (String[])session.getAttribute("ids
Business logic vs Presentation logic - JSP-Servlet
Business logic vs Presentation logic  what is the difference between Business logic and Presentation logic
What is programming logic ?
What is programming logic ?  What is programming logic
WEB LOGIC - JSP-Servlet
WEB LOGIC project  I want the procedure to run a project in we logic server
the business logic is executed.
the business logic is executed.  In which method of Action class the business logic is executed
what is the logic of this pattern?
what is the logic of this pattern?   1 121 12321 1234321
struts logic tags
struts logic tags  what is the use of struts logic tag   The purpose of Struts logic tags is to alter output depending on the given...://www.roseindia.net/struts/struts-logictags/logic-tags-introduction.shtml http
About Web-Logic
the Web-Logic with Tomcat 5.0 version in Console. Somebody has suggested to see the webpage (they had given the link).But when i installed the Web-Logic i... folder in the Web-Logic
Struts logic iterate
Struts logic iterate  This is my jsp page in which i used 3 logic...; <%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>...; <body> <h1> Search </h1> <logic:iterate name
logic for pattern program
logic for pattern program  what's the logic for create pattern program how can i create any pattern program with in minute. like this 123454321... create this program in java without help whats the logic how can i understand
logic iterate tag - Struts
logic iterate tag  Hey I am displaying the values in a jsp called categoryView.jsp using logic iterate tag as Now properties bname and quant belongs to another formbean named as ViewCategoryForm.java.When I
logic for c language
logic for c language  01 02 03 04 05 06 20 21 22 23 24 07 19 32 33 34 25 08 18 31 36 35 26 09 17 30 29 28 27 10 16 15 14 13 12 11
Tell us the logic of diceroller
Tell us the logic of diceroller  import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class DiceRollerServlet extends... is " +dice2); } } dice1 =3 dice2 =2 How is the logic executed????   
Please explain the logic....
Please explain the logic....  class A1 { } class B extends A1 { } public class ComingThru { static String s = "-"; public static void main(String[] args) { A1[] aa = new A1[2]; B[] ba = new B[2
Business Logic in mvc2 - JSP-Servlet
Business Logic in mvc2  What is business logic and where it is written using servlet and jsp
struts logic:iterate tag
struts logic:iterate tag  Hi All, I am writing a look up jsp which is using logc:iterate every thing is fine except this the problem here is unable to go inside the tag. Here is the stack trace I am getting. [#|2010-10-27T00
Logic error? HELP PLEASE! :(
Logic error? HELP PLEASE! :(  Hello Guys! i have a huge problem. What I want to do is there is a retrieve jsp page. In the retrieve jsp page there is a text box which user to key in their email and one more dropdownlist which get
Struts Logic Tags
Struts Logic Tags       Struts Logic Tags examples. Introduction to Struts Logic Tags Struts logic tags are conditional tags that replaces
leap year logic - Java Beginners
leap year logic  hi frds.. can u give me logic for leap year..  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/Leapyear.shtml Thanks
what's the logic for create pattern program
what's the logic for create pattern program   1 2 3 4 5 5 1 2 3 4 4 5 1 2 3 3 4 5 1 2 2 3 4 5 1
why business logic in servlets - JSP-Interview Questions
why business logic in servlets  why business logic written using servlets not in jsp. Jsp used for presentation purpose. serlvet used for coding business logic and controller logic. Reason for using servlets in business logic
RetDAO.java (part1) ..reference. Is this logic good?
RetDAO.java (part1) ..reference. Is this logic good?  public static int searchDelete(Connection conn,String ret_id) throws Exception { //System.out.println(ret_id); st=conn.createStatement
RetDAO.java (part1) ..reference. Is this logic good?
RetDAO.java (part1) ..reference. Is this logic good?  public static int searchDelete(Connection conn,String ret_id) throws Exception { //System.out.println(ret_id); st=conn.createStatement
Web Logic Administrator
Web Logic Administrator       Position Vacant: Web Logic Administrator Job Description  We are looking for Web Logic Administrator  Candidate
Business Objects of Business Logic tier
Business Objects of Business Logic tier   ... will develop the objects of business logic tier. Business logic tier referrers... logic tier communicates both with user interface tier and the database tier
Struts Logic Tags: An Introduction
Struts Logic Tags: An Introduction       Struts logic tags are conditional tags...; matching strings and substrings... Logic tags available in the Struts Framework
deploy jsp using web logic - Java Beginners
deploy jsp using web logic  Hi all, I am new in Web logic server please tell me what is the steps of writing deployee the jsp using web logic. and steps also arrange the folder its urgent
Separating UI from Logic
Java NotesSeparating UI from Logic One of the most important ideas... and controller, ...) from the logic (model, engine, ...). There are two really..., maintain, etc. A different user interface or logic model can be added
Separating UI from Logic
Java NotesSeparating UI from Logic One of the most important ideas... and controller, ...) from the logic (model, engine, ...). There are two really..., maintain, etc. A different user interface or logic model can be added
Advertisements
 

 

 

DMCA.com