> For the complete documentation index, see [llms.txt](https://www.precollege.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.precollege.net/session-10/source-code.md).

# Source Code

## Session10.java

```java
import java.util.*;
import java.io.*;

public class Session10 {
    public static void main(String[] args) {
        String myName = ""; // add your name
        System.out.println("Session 10" + " - " + 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 "Q":
                System.out.println("Quitting..!");
                break;
        }
    }

    // example1 method
    public static void example1() {
        // declare arrays


        // traverse arrays
 

        // first student name
        
        // first student grade
        

    }

    // example2 method
    public static void example2() {
        // Create and initialize the parallel ArrayLists
        

        // traverse ArrayLists
        

        // add to ArrayLists
        

        // print ArrayLists
        

    }

    // example3 method
    public static void example3() {
        // Create a HashMap
        

        // add elements
        

        // traverse HashMap
        

        // check and remove
        

    }

    // example4 method
    public static void example4() {
        // create HashMap
        HashMap<String, Double> inventory = new HashMap<>();

        // open file
        try {
            File file = new File("newegg.csv");
            Scanner scanner = new Scanner(file);

            // Skip the first line (header)
            if (scanner.hasNextLine()) {
                scanner.nextLine();
            }
            while (scanner.hasNextLine()) {
                String line = scanner.nextLine();
                String[] parts = line.split(",");
                String item = parts[0].trim();
                double price = Double.parseDouble(parts[1].trim());
                inventory.put(item, price);
            }
            scanner.close();
        } catch (FileNotFoundException e) {
            System.out.println("File not found: newegg.csv");
        }

        // Print the loaded inventory
        

    }
}

```

## newegg.csv

```csv
Part Name,Price
Intel Core i9-12900K,303.26
AMD Ryzen 7 7800X3D,340.05
Gigabyte Radeon RX 7600 XT 16GB,359.97
Samsung 990 PRO 1TB NVMe SSD,99.99
WD Black SN850X 1TB NVMe SSD,274.37
ASRock Phantom Gaming PG-850G PSU,99.99
64GB DDR5 6000MHz RGB Memory Kit,279.99
IceGiant ProSiphon Titan-TR 360 Cooler,439.99
Coolerguys LGA1700 240W Tower Cooler,59.95
iFixit Thermal Paste,9.95
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
