😎
Introduction to Programming with Java
  • Introduction to Programming with Java
  • Session 1
    • Assignment1.java
  • Session 2
    • Source Code
    • Activities
    • Assignment
  • Session 3
    • Source Code
    • Activities
    • Assignment
  • Session 4
    • Source Code
    • Activities
  • Session 5
    • Source Code
    • Project
  • Session 6
    • Source Code
  • Session 7
    • Source Code
  • Session 8
    • Source Code
  • Session 9
    • Source Code
  • Session 10
    • Source Code
Powered by GitBook
On this page
  1. Session 5

Project

Source Code

import java.util.*;

public class Project1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String myName = ""; // Add your name
        System.out.println("Project 1 - " + myName);

        // menu variables
        boolean done = false;
        String choice;

        do {
            // Menu
            System.out.println("Menu");
            System.out.println("S - Start");
            System.out.println("Q - Quit");
            System.out.print("Choice: ");
            choice = in.nextLine();

            switch (choice) {
                case "S":
                    start();
                    break;
                default:
                    System.out.println("Invalid Choice");
                    break;
            }
        } while (!done);
    }

    public static void start() {
        System.out.println("Welcome to My Adventure!");
    }
}
PreviousSource CodeNextSource Code

Last updated 10 months ago