Posts

Showing posts with the label Java programming

ATM Java code

Image
This is an ATM kind of machine. Programmed without exceptions. ...................................................... import javax.swing.*; /**@author LEE (Mafanga Lolito)  *  * @version ATM PIN Checker 1.0 (Without Exceptions)  *  * @since  : 04 September 2012  */ public class ATM{ public static void main ( String args []){ int countWrong = 3; int pin = 123; int thePin = 0; while ( thePin != pin){ String thePinString= JOptionPane.showInputDialog(null,"Enter your Password :","Umbrella Corporation!"); thePin = Integer.parseInt(thePinString); // Counts wrong pins entered countWrong--; //if the count is = 3, meaning the wrong pin is entered 3 times //the program breaks and displays the message if ( countWrong == 0 && thePin != pin){ JOptionPane.showMessageDialog(null,"ACCESS  REVOKED!\n","Umbrella Corporation.", JOptionPane.ERROR_MESSAGE); JOptionPane...

Java Programming : Airtime Left balance calculator.

import javax.swing.JOptionPane; public class Airtime {     public static void main(String args[]){                 double Amount =0;         double Duration =0;         double CallCostPerMinute =0;         boolean goodInput = false;         boolean good = false;         boolean Good = false;                                 String AmountString=JOptionPane.showInputDialog(null, "Enter the amout of Airtime you have :",JOptionPane.ERROR_MESSAGE);                 do         {             try  ...