Source Code

Module3.java

import java.util.*;

public class Module3 {
    public static void main(String[] args) {
        System.out.println("Module 3 Part 1 Examples");
        // Create new Scanner object (don't delete!)
        Scanner in = new Scanner(System.in);
        // menu variables
        boolean done = false;
        String choice;
        // do while menu loop
        do {
            System.out.println("E1 - Example 1");
            System.out.println("E2 - Example 2");
            System.out.println("E3 - Example 3");
            System.out.println("E4 - Example 4");
            System.out.println("E5 - Example 5");
            System.out.println("Q - Quit");
            System.out.print("Choice: ");
            choice = in.nextLine();
            switch (choice) {
                case "E1":
                    System.out.println("Example 1 Main Method");
                    // example1 method call

                    break;
                case "E2":
                    System.out.println("Example 2");
                    // example2 method call
 
                    break;
                case "E3":
                    System.out.println("Example 3");
                    // example3 method call

                    break;
                case "E4":
                    System.out.println("Example 4");
                    // example4 method call

                    break;
                case "E5":
                    System.out.println("Example 5");
                    // example5 method call

                    break;
                // quit and default cases
                case "Q":
                    System.out.println("Quit");
                    done = true;
                    break;
                default:
                    System.out.println("Invalid Choice");
                    break;
            }
        } while (!done);

        // close the Scanner (don't delete!)
        in.close();
    }
    // example1 method

    // example2 method
    
    // example3 method

    // example4 method

    // example5 method
 
}

Module3_2.java

import java.util.*;

public class Module3_2 {
    public static void main(String[] args) {
        System.out.println("Module 3 Part 2 Examples");
        // Create new Scanner object (don't delete!)
        Scanner in = new Scanner(System.in);
        // menu variables
        boolean done = false;
        String choice;
        // do while menu loop
        do {
            System.out.println("E1 - Example 1");
            System.out.println("E2 - Example 2");
            System.out.println("E3 - Example 3");
            System.out.println("E4 - Example 4");
            System.out.println("E5 - Example 5");
            System.out.println("E6 - Example 6");
            System.out.println("Q - Quit");
            System.out.print("Choice: ");
            choice = in.nextLine();
            switch (choice) {
                case "E1":
                    System.out.println("Example 1");
                    // Create Counter object
                    
                    // Increment counter
                   
                    // Printer counter value
                    
                    // Reset counter value
                    
                    // Printer counter value (again)
                    
                    // click twice and print the value
                    
                    

                    break;
                case "E2":
                    System.out.println("Example 2");
                    // Create two Dice object
                    
                    // Print their values
                    
                    // roll the dice
                    
                    // Print their values
                    
                    break;
                case "E3":
                    System.out.println("Example 3");
                    // create sam object
                    
                    // deposit $100
                    
                    // withdraw $50
                    
                    break;
                case "E4":
                    System.out.println("Example 4");
                    // teddi object
                    
                    // deposit $500
                    
                    // withdraw $499
                    
                    break;
                case "E5":
                    System.out.println("Example 5");
                    // devin object
                    
                    // withdraw $250
                    
                    break;
                case "E6":
                    System.out.println("Example 6");
                    // jada object
                    
                    // withdraw $2500
                    
                    break;
                // quit and default cases
                case "Q":
                    System.out.println("Quit");
                    done = true;
                    break;
                default:
                    System.out.println("Invalid Choice");
                    break;
            }
        } while (!done);

        // close the Scanner (don't delete!)
        in.close();
    }
}

Counter.java

// class header


    // private instance variable(s)
    

    // Constructor
    

    // accessor method(s)
    

    // mutator method(s)
    


Dice.java

import java.util.*;

// class header
public class Dice {
    // private instance variable


    // Constructor


    // roll method()

        // assign faceValue to a random number


    // getFaceValue method


    // toString method returns a string representation of this die.
    

BankAccount.java

// header


    // private instance variables
 

    // constructors
    // no argument constructor

    // one argument constructor

    // two argument constructor

    // three argument constructor

    // methods
    // deposit method
 
    // withdraw method
    
    // getBalance method

    // toString method returns a string representation of this die.
    

Last updated