# Source Code

## Session5.java

```java
import java.util.*;

public class Session5 {
    public static void main(String[] args) {
        String myName = ""; // add your name
        System.out.println("Session 5 " + " - " + myName);

        // Menu
        System.out.println("Menu");
        System.out.println("E1 - Example 1");

        // setup Scanner
        Scanner in = new Scanner(System.in);
        System.out.print("Choice: ");
        String choice = in.nextLine();

        // switch choices
        switch (choice) {
            case "E1":
                System.out.println("Example 1");
                // call greeting method
                
                break;
            case "E2":
                System.out.println("Example 2");
                // call greeting method
                
                break;
            case "E3":
                System.out.println("Example 3");
                // call mantra method
                
                break;
            case "E4":
                System.out.println("Example 4");
                // call sumNumbers method
                
                break;
            case "E5":
                System.out.println("Example 5");
                // call checkDivisibility method
            
                break;
            case "E6":
                System.out.println("Example 6");
                // call earnings method
                
                break;
            default:
                System.out.println("Invalid Choice");

        }
    }
    // define greeting method
    

    // define mantra method
    
    
    // define sumNumbers method
    
    
    // define checkDivisbility method
    
    
    // define earnings method
   
   

}

```

## Session5v2.java

```java
import java.util.*;

public class Session5v2 {
    public static void main(String[] args) {
        String myName = ""; // add your name
        System.out.println("Session 5v2" + " - " + myName);

        // Menu
        System.out.println("Menu");
        System.out.println("E1 - Example 1");
        System.out.println("Q  - Quit");

        // setup Scanner
        Scanner in = new Scanner(System.in);
        System.out.print("Choice: ");
        String choice = in.nextLine();

        // switch choices
        switch (choice) {
            case "E1":
                System.out.println("Example 1");
                example1();
                break;
            case "E2":
                System.out.println("Example 2");
                example2();
                break;
            case "E3":
                System.out.println("Example 3");
                example3();
                break;
            case "E4":
                System.out.println("Example 4");
                example4();
                break;
            case "E5":
                System.out.println("Example 5");
                example5();
                break;
            case "E6":
                System.out.println("Example 6");
                example6();
                break;
            case "E7":
                System.out.println("Example 7");
                example7();
                break;
            case "E8":
                System.out.println("Example 8");
                example8();
                break;
            case "E9":
                System.out.println("Example 8");
                example9();
                break;
            case "Q":
                System.out.println("Quitting..!");
                break;
        }
    }

    // example1 method
    public static void example1() {
        // declares an array of integers
        

        // create an empty array of size 3
        

        // print the values in the scores array
        

        // declare and create an array of doubles
        

        // assign values to each index position
        

        // print the values in the prices array
        

    }

    // example2 method
    public static void example2() {
        // declare an array of String elements
        

        // assign values to each index position
        

        // print the values in the friends array
        

    }
    // example3 method
    public static void example3() {
        // create an array with an initializer list
        

        // .length property
        
    }

    // example4 method
    public static void example4() {
        // declare and create an array
        int[] arr = { 10, 20, 30, 40, 50 };

        // for loop to traverse the array
        

    }

    // example5 method
    public static void example5() {
        // declare and create an array
        double[] arr = { 1.1, 2.2, 3.3, 4.4, 5.5 };

        // while loop to traverse the array
        

    }

    // example6 method
    public static void example6() {
        // declare and create an array
        int[] arr = { 1, 2, 3, 4, 5 };

        // accumulator pattern
        

    }

    // example7 method
    public static void example7() {
        // declare array
        int[] arr = { 50, 100, 75, 25, 80 };

        // initialize max to first value
        

        // for loop
        
        
    }

    // example8 method
    public static void example8() {
        // declare array numbers
        int[] numbers = { 1, 2, 3, 4, 5 };
        // pass numbers to printArray method
        

        // pass numbers to changeArray method
        
        
    }

    // example9 method
    public static void example9() {
        // declare array
        int[] numArray = {3, 8, -3, 2, 1};
        
                
        // create an instance of ArrayWorker
        
        // call mystery method
        

    }

    // changeArray method
    public static void changeArray(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = arr[i] * 2;
        }
    }

    // printArray method
    public static void printArray(int[] arr) {
        System.out.println("Print Array");
        System.out.println("Index\tValue");
        for (int i = 0; i < arr.length; i++) {
            System.out.println(i + "\t" + arr[i]);
        }
    }
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.precollege.net/session-5/source-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
