Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a software system that simulates a real world system (such as ATMs, banks

ID: 3776214 • Letter: D

Question

Design a software system that simulates a real world system (such as ATMs, banks, courses, games...). The program (the software system) must contain selection (if), repetition (loop), methods, user DEFINE class, and arrays. The documents include flowchart, UML, and comments in the program. You have to present your program (demonstration and explanation) on 11//28/2016 This program is 130 points (100 + 30 presentation). 2D arrays Relate classes through inheritance or composition. Design the system to perform more functions.

Explanation / Answer

public class AtmMachine {

    Scanner input;

    int[] validId;

    Atm createOne;

    // AtmMachine constructor

    AtmMachine() {

        input = new Scanner(System.in);

        createOne=new Atm();

       validId = new int[10];     

    }

    void performOperations() {

        int choice;

        double withdraw,balance;

        for(int i=0; i<validId.length; i++){

            //Prompt user to enter the identification number(ID)

            System.out.print("Enter an id: ");

            validId[i]=createOne.setId(input.nextInt());

            //Prompt user to enter the correct identification number(ID)

            while((validId[i]<0)||(validId[i]>9)){

                System.out.println(" Invalid id! Please enter your id again.");

                System.out.print(" Enter an id: ");

                validId[i]=createOne.setId(input.nextInt());

            }

            while(true){

                displayMenu();

                //Prompt user to enter the choice

                System.out.print("Enter a choice: ");

                choice=createOne.setChoice(input.nextInt());

                balance=createOne.getBalance();

                //Display the choice results

                switch(choice){

                case 1:System.out.println(" The balance is "+balance);

                break;

                case 2:System.out.print(" Enter an amount to withdraw: ");

                withdraw=createOne.setWithdraw(input.nextDouble());

                if(createOne.setBalance(balance)>=withdraw){

                    createOne.getWithdraw();

                }

                else{

                    System.out.println(" Not enough balance. Balance is "+createOne.setBalance(balance));

                }   

                break;

                case 3:System.out.print(" Enter an amount to deposit: ");

                double deposit=createOne.setDeposit(input.nextDouble());

                createOne.getDeposit();

                break;

                case 4:System.out.print(" Enter an id: ");

                validId[i]=createOne.setId(input.nextInt());

                while(validId[i]<0||validId[i]>9){

                    System.out.println(" Invalid id! Please enter your id again.");

                    System.out.print(" Enter an id: ");

                    validId[i]=createOne.setId(input.nextInt());

                }

                break;              

                case 5: return;

                

                default:System.out.println(" Invalid selection. Please select your choice again.");

                }

            }

        }

    }

    private void displayMenu() {

        //Display the main menu

        System.out.println(" Main menu ");

        System.out.println("    1:check balance ");    

        System.out.println("    2:withdraw ");

        System.out.println("    3:deposit ");

        System.out.println("    4:exit ");

        System.out.println("    5:logout ");

    }

    

    /**This program is created to simulate an ATM Machine.

       main method*/

    public static void main(String[] args) {

        AtmMachine am = new AtmMachine();      // line 1

        am.performOperations();                // line 2

    }   // <---- that's it !!!

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote