06 — Extended Portfolio

More Projects

A full rundown of what each project actually does — the mechanics, the data handling, and the details that don't fit on the homepage cards.

Featured / 001

Java Battle Game

A two-player turn-based battle game with attack, defend, and heal mechanics, a coin betting pot, and randomized critical hits. Each action triggers its own sound effect, played on a background thread so the game never stalls.

Java OOP Multithreading Game Logic

⚙️ Key Features

  • Interactive two-player turn-based combat driven entirely by user input
  • Attack deals randomized damage with a 20% chance of a critical hit (2× damage)
  • Defend halves incoming damage for one turn, then resets
  • Heal restores HP up to the max, capped at 3 uses per player
  • A coin betting pot is settled once a winner is decided
  • Every action — attack, heal, invalid input, victory — triggers its own sound effect on a background thread

📚 What I Learned

  • Managing player state (HP, defending flag, heal count) with parallel arrays
  • Structuring a game loop with while and switch-case for player actions
  • Using static final constants for fixed values like MAX_HP and MAX_HEAL
  • Running sound playback on a separate thread so it never blocks the game loop
  • Integrating an external library (JLayer) for MP3 playback
Project1.java
import java.io.FileInputStream;
import java.util.Random;
import java.util.Scanner;

import javazoom.jl.player.Player;

public class Project1 {

    static final int MAX_HP = 100;
    static final int MAX_HEAL = 3;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Random r = new Random();

        int[] hp = { MAX_HP, MAX_HP };
        boolean[] defending = { false, false };
        int[] healcount = { 0, 0 };
        String[] p = new String[2];

        int current = 0;

        System.out.print("Enter Player 1 Name: ");
        p[0] = sc.nextLine();
        playSound("rizz-sound-effect.mp3");

        System.out.print("Enter Player 2 Name: ");
        p[1] = sc.nextLine();
        playSound("rizz-sound-effect.mp3");

        int total = getBet(sc, p[0]) + getBet(sc, p[1]);

        while (hp[0] > 0 && hp[1] > 0) {
            int opponent = 1 - current;

            displayStatus(p, hp, defending, healcount);

            System.out.println("\n" + p[current] + "'s Turn");
            System.out.println("1. Attack  2. Defend  3. Heal");

            int choice = sc.nextInt();

            switch (choice) {
            case 1:
                attack(r, p, hp, defending, current, opponent);
                break;

            case 2:
                defending[current] = true;
                System.out.println(p[current] + " is defending!");
                break;

            case 3:
                heal(r, p, hp, healcount, current);
                break;

            default:
                System.out.println("Invalid choice!");
                playSound("vine-boom.mp3");
                continue;
            }

            if (hp[opponent] <= 0)
                break;

            current = opponent;
        }

        System.out.println("\n===== GAME OVER =====");
        if (hp[0] <= 0) {
            System.out.println(p[1] + " Wins!");
        } else {
            System.out.println(p[0] + " Wins!");
        }
        playSound("rizz-sound-effect.mp3");
        System.out.println("CONGRALUTIONS YOU WIN ¥" + total);

    }

    static void attack(Random r, String[] p, int[] hp, boolean[] defending, int current, int opponent) {
        int damage = r.nextInt(11) + 10;
        if ((r.nextInt(2) == 0)) {
            playSound("重いキック1.mp3");
        } else {
            playSound("punch-gaming-sound-effect-hd_RzlG1GE.mp3");
        }

        if (r.nextInt(100) < 20) {
            damage *= 2;
            System.out.println("🔥 CRITICAL HIT!");
            playSound("bone-crack.mp3");
        }

        if (defending[opponent]) {
            damage /= 2;
            defending[opponent] = false;
            playSound("rizz-sound-effect.mp3");
        }

        hp[opponent] -= damage;
        System.out.println(p[current] + " attacked for " + damage + " damage!");
    }

    static void heal(Random r, String[] p, int[] hp, int[] healcount, int current) {
        if (healcount[current] >= MAX_HEAL) {
            System.out.println("❌ No heals left!");
            playSound("fahhhhhhhhhhhhhh.mp3");
            return;
        }

        int heal = r.nextInt(20) + 5;
        hp[current] = Math.min(MAX_HP, hp[current] + heal);
        healcount[current]++;

        playSound("anime-wow-sound-effect.mp3");
        System.out.println(p[current] + " healed " + heal + " HP!");
    }

    static int getBet(Scanner sc, String player) {
        System.out.print(player + ", enter your bet: ");
        int bet = sc.nextInt();

        if (bet < 1000) {
            playSound("999-social-credit-siren.mp3");
        } else {
            playSound("anime-wow-sound-effect.mp3");
        }

        return bet;
    }

    static void displayStatus(String[] p, int[] hp, boolean[] defending, int[] healcount) {
        for (int i = 0; i < 2; i++) {
            System.out.println(p[i] + " HP: " + hp[i] +
                    (defending[i] ? " (Defending)" : "") +
                    " | Heals left: " + (MAX_HEAL - healcount[i]));
        }
    }

    static void playSound(String fileName) {
        new Thread(() -> {
            try {
                FileInputStream file = new FileInputStream(fileName);
                Player sound = new Player(file);
                sound.play();
            } catch (Exception e) {
                System.out.println("⚠ Sound error: " + fileName);
            }
        }).start();
    }
}
Featured / 002

Expense Tracker

A console-based personal finance tool for logging daily spending. Add, delete, and search expenses by year, month, or category, with every record persisted to a CSV file and totals calculated on demand.

Java File I/O CSV ArrayList

⚙️ Key Features

  • Add an expense with amount, category, date, and note — IDs auto-increment from existing records
  • View every expense as an aligned table in the console
  • Delete an expense by ID, rewriting the CSV without that row
  • Search expenses by year, month, or category
  • Calculate and display the running total across all expenses
  • Data survives between sessions in a plain CSV file (Expensesdb.csv)

📚 What I Learned

  • Splitting responsibilities across Manager, Database, and Model classes
  • Reading and writing structured data to a CSV file with BufferedReader/FileWriter
  • Rebuilding a file's contents in place to support deletion by ID
  • Filtering an ArrayList of objects by year, month, or category
Project2.java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Scanner;

public class Project2 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        ViewScreen view = new ViewScreen();
        ExpensesManager em = new ExpensesManager();

        while (true) {
            System.out.println("\n1.Add New Expenses");
            System.out.println("2.Show All Expenses");
            System.out.println("3.Delete Expense");
            System.out.println("4.Search");
            System.out.println("5.Show Total Amount");
            System.out.println("6.Exit");
            System.out.println("Enter the number: ");

            int menu = sc.nextInt();
            sc.nextLine();

            if (menu == 1) {

                System.out.println("Enter the Amount");
                double amount = sc.nextDouble();
                sc.nextLine();

                System.out.println("Enter the category");
                String category = sc.nextLine();

                System.out.println("Enter the date (yyyy-MM-dd)");
                String date = sc.nextLine();

                System.out.println("Enter the note");
                String note = sc.nextLine();

                String[] parts = date.split("-");
                int year = Integer.parseInt(parts[0]);
                int month = Integer.parseInt(parts[1]);

                ArrayList<Expenses> list = em.getAllExpenses();
                int id = 1;
                for (Expenses exp : list) {
                    if (exp.getId() >= id) {
                        id = exp.getId() + 1;
                    }
                }

                Expenses e = new Expenses();
                e.setId(id);
                e.setAmount(amount);
                e.setCategory(category);
                e.setDate(date);
                e.setNote(note);
                e.setMonth(month);
                e.setYear(year);

                em.addExpense(e);

                System.out.println("Expense Added!");

            } else if (menu == 2) {

                view.itemList(em.getAllExpenses());

            } else if (menu == 3) {

                System.out.println("Enter ID to delete:");
                int id = sc.nextInt();
                em.delete(id);

            } else if (menu == 4) {

                System.out.println("Search by:");
                System.out.println("1.By Year");
                System.out.println("2.By Month");
                System.out.println("3.By Category");

                int smenu = sc.nextInt();
                sc.nextLine();

                if (smenu == 1) {
                    System.out.println("Enter the Year:");
                    int year = sc.nextInt();
                    view.itemList(em.searchByYear(year));

                } else if (smenu == 2) {
                    System.out.println("Enter the Month:");
                    int month = sc.nextInt();
                    view.itemList(em.searchByMonth(month));

                } else if (smenu == 3) {
                    System.out.println("Enter the Category:");
                    String category = sc.nextLine();
                    view.itemList(em.searchByCategory(category));
                }

            } else if (menu == 5) {

                view.showTotal();

            } else {
                System.out.println("Exiting...");
                break;
            }
        }
    }
}

class ViewScreen {

    ExpensesManager em = new ExpensesManager();

    public void showTotal() {
        System.out.println("Total Expenses : " + em.getTotal());
    }

    public void itemList(ArrayList<Expenses> expense) {

        if (expense.isEmpty()) {
            System.out.println("No data found.");
            return;
        }

        System.out.printf("%-5s %-10s %-15s %-12s %-20s\n",
                "ID", "Amount", "Category", "Date", "Note");
        System.out.println("---------------------------------------------------------------");

        for (Expenses e : expense) {
            System.out.printf("%-5d %-10.2f %-15s %-12s %-20s\n",
                    e.getId(),
                    e.getAmount(),
                    e.getCategory(),
                    e.getDate(),
                    e.getNote());
        }
    }
}

class ExpensesManager {

    private ExpensesDatabase ed = new ExpensesDatabase();

    public void addExpense(Expenses e) {
        ed.insertExpense(e);
    }

    public ArrayList<Expenses> getAllExpenses() {
        return ed.getExpenses();
    }

    public ArrayList<Expenses> searchByYear(int year) {
        return ed.filterByYear(ed.getExpenses(), year);
    }

    public ArrayList<Expenses> searchByMonth(int month) {
        return ed.filterByMonth(ed.getExpenses(), month);
    }

    public ArrayList<Expenses> searchByCategory(String category) {
        return ed.filterByCategory(ed.getExpenses(), category);
    }

    public double getTotal() {
        return ed.calTotal(ed.getExpenses());
    }

    public void delete(int id) {
        ed.deleteExpenses(id);
    }
}

class ExpensesDatabase {

    public double calTotal(ArrayList<Expenses> expense) {
        double total = 0;
        for (Expenses e : expense) {
            total += e.getAmount();
        }
        return total;
    }

    public ArrayList<Expenses> filterByYear(ArrayList<Expenses> expense, int year) {
        ArrayList<Expenses> result = new ArrayList<>();
        for (Expenses e : expense) {
            if (e.getYear() == year)
                result.add(e);
        }
        return result;
    }

    public ArrayList<Expenses> filterByMonth(ArrayList<Expenses> expense, int month) {
        ArrayList<Expenses> result = new ArrayList<>();
        for (Expenses e : expense) {
            if (e.getMonth() == month)
                result.add(e);
        }
        return result;
    }

    public ArrayList<Expenses> filterByCategory(ArrayList<Expenses> expense, String category) {
        ArrayList<Expenses> result = new ArrayList<>();
        for (Expenses e : expense) {
            if (e.getCategory().equalsIgnoreCase(category)) {
                result.add(e);
            }
        }
        return result;
    }

    public void insertExpense(Expenses e) {
        try {
            FileWriter fw = new FileWriter("Expensesdb.csv", true);

            fw.write("\n" +
                    e.getId() + "," +
                    e.getAmount() + "," +
                    e.getCategory() + "," +
                    e.getDate() + "," +
                    e.getNote() + "," +
                    e.getMonth() + "," +
                    e.getYear() + "\n");

            fw.close();

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public void deleteExpenses(int id) {
        try {
            BufferedReader br = new BufferedReader(new FileReader("Expensesdb.csv"));
            ArrayList<String> lines = new ArrayList<>();
            String line;

            while ((line = br.readLine()) != null) {
                String[] data = line.split(",");
                if (Integer.parseInt(data[0]) != id) {
                    lines.add(line);
                }
            }
            br.close();

            FileWriter fw = new FileWriter("Expensesdb.csv");
            for (String l : lines) {
                fw.write(l + "\n");
            }
            fw.close();

            System.out.println("Deleted successfully!");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public ArrayList<Expenses> getExpenses() {
        ArrayList<Expenses> list = new ArrayList<>();

        try {
            BufferedReader br = new BufferedReader(new FileReader("Expensesdb.csv"));
            String line;

            while ((line = br.readLine()) != null) {
                String[] d = line.split(",");
                if (d.length < 7)
                    continue;

                Expenses e = new Expenses();
                e.setId(Integer.parseInt(d[0]));
                e.setAmount(Double.parseDouble(d[1]));
                e.setCategory(d[2]);
                e.setDate(d[3]);
                e.setNote(d[4]);
                e.setMonth(Integer.parseInt(d[5]));
                e.setYear(Integer.parseInt(d[6]));

                list.add(e);
            }

            br.close();

        } catch (Exception e) {
            e.printStackTrace();
        }

        return list;
    }
}

class Expenses {

    private int id;
    private double amount;
    private String category;
    private String date;
    private String note;
    private int month;
    private int year;

    public int getId() { return id; }
    public void setId(int id) { this.id = id; }
    public double getAmount() { return amount; }
    public void setAmount(double amount) { this.amount = amount; }
    public String getCategory() { return category; }
    public void setCategory(String category) { this.category = category; }
    public String getDate() { return date; }
    public void setDate(String date) { this.date = date; }
    public String getNote() { return note; }
    public void setNote(String note) { this.note = note; }
    public int getMonth() { return month; }
    public void setMonth(int month) { this.month = month; }
    public int getYear() { return year; }
    public void setYear(int year) { this.year = year; }
}
003

Cafe Ordering System

A console cafe simulation with a browsable menu, multi-item orders via a running cart, automatic bill calculation, and a printed receipt — fully localized in Japanese.

Java OOP HashMap Console

⚙️ Key Features

  • Browsable menu of 10 items, each with a name, price, star rating, and description
  • Separate list view and detail view for individual menu items
  • Multi-item ordering with quantities tracked in a HashMap keyed by item number
  • A balance check that blocks checkout if the customer can't cover the total
  • A printed receipt breaking down each item, quantity, and subtotal

📚 What I Learned

  • Modeling real-world roles (Customer, Waiter, Menu, Bill) as separate classes
  • Using a HashMap to track order quantities keyed by menu item number
  • Validating a purchase against available balance before charging
PracofCafe.java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class PracofCafe {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        Customer c = new Customer();
        Waiter w = new Waiter();

        System.out.println("━━━☕ Caffeine Lab ☕━━━");

        w.sayGreet();
        int members = c.tellMembers();
        w.confirmMembers(members);

        CafeDatabase db = new CafeDatabase();
        ArrayList<Menu> menu = db.getMenu();

        w.giveMenu(menu);

        CafeView view = new CafeView();

        while (true) {
            System.out.println("\n1️⃣ 一覧  2️⃣ 詳細  3️⃣ 注文へ");
            System.out.print("👉 選択: ");
            int choice = sc.nextInt();

            if (choice == 1) {
                view.showList(menu);
            } else if (choice == 2) {
                System.out.print("👉 商品番号: ");
                int no = sc.nextInt();
                if (no > 0 && no <= menu.size()) {
                    view.showDetails(menu.get(no - 1));
                }
            } else if (choice == 3) {
                break;
            } else {
                System.out.println("❌ 無効な選択");
            }
        }

        w.takeOrder();
        HashMap<Integer, Integer> orders = c.sayOrder(menu);

        int total = w.confirmOrder(orders, menu);

        if (c.getMoney() < total) {
            System.out.println("❌ お金が足りません!");
            return;
        }

        Bill b = new Bill();
        b.showBill(orders, menu, total);

        c.askBill();
        c.paybill(total);

        w.sayThanks();
    }
}

class Bill {

    public void showBill(HashMap<Integer, Integer> orders, ArrayList<Menu> menu, int total) {

        System.out.println("\n━━━━━━━━━━━━━━━━━━━━");
        System.out.println("🧾 レシート");
        System.out.println("━━━━━━━━━━━━━━━━━━━━");

        for (int key : orders.keySet()) {
            Menu m = menu.get(key - 1);
            int qty = orders.get(key);

            System.out.println("🍽️ " + m.getName() + " × " + qty + " = " + (m.getPrice() * qty) + "円");
        }

        System.out.println("━━━━━━━━━━━━━━━━━━━━");
        System.out.println("💰 合計: " + total + "円");
        System.out.println("━━━━━━━━━━━━━━━━━━━━");
    }
}

class CafeDatabase {

    public ArrayList<Menu> getMenu() {

        ArrayList<Menu> menu = new ArrayList<>();

        menu.add(new Menu("Cappuccino", 450, 4.5, "Espresso with milk foam"));
        menu.add(new Menu("Latte", 500, 4.6, "Smooth coffee with milk"));
        menu.add(new Menu("Espresso", 350, 4.3, "Strong black coffee"));
        menu.add(new Menu("Mocha", 550, 4.7, "Chocolate coffee"));
        menu.add(new Menu("Iced Coffee", 400, 4.2, "Cold coffee"));
        menu.add(new Menu("Cheesecake", 600, 4.8, "Creamy cake"));
        menu.add(new Menu("Chocolate Cake", 580, 4.7, "Rich chocolate"));
        menu.add(new Menu("Croissant", 300, 4.1, "Buttery pastry"));
        menu.add(new Menu("Sandwich", 500, 4.3, "Fresh sandwich"));
        menu.add(new Menu("Pancakes", 650, 4.6, "Soft pancakes"));

        return menu;
    }
}

class CafeView {

    public void showList(ArrayList<Menu> menu) {

        for (int i = 0; i < menu.size(); i++) {
            Menu m = menu.get(i);

            System.out.println("━━━━━━━━━━━━━━━━━━━━");
            System.out.println("🍽️ No." + (i + 1));
            System.out.println("📌 " + m.getName());
            System.out.println("💰 " + m.getPrice() + "円");
        }
    }

    public void showDetails(Menu m) {

        System.out.println("━━━━━━━━━━━━━━━━━━━━");
        System.out.println("🍽️ " + m.getName());
        System.out.println("💰 " + m.getPrice() + "円");

        System.out.print("⭐ " + m.getRating() + " ");
        for (int i = 0; i < (int) m.getRating(); i++) {
            System.out.print("★");
        }
        System.out.println();

        System.out.println("📝 " + m.getDetail());
        System.out.println("━━━━━━━━━━━━━━━━━━━━");
    }
}

class Menu {
    private String name;
    private int price;
    private double rating;
    private String detail;

    public Menu(String name, int price, double rating, String detail) {
        this.name = name;
        this.price = price;
        this.rating = rating;
        this.detail = detail;
    }

    public String getName() { return name; }
    public int getPrice() { return price; }
    public double getRating() { return rating; }
    public String getDetail() { return detail; }
}

class Customer {

    private int money = 2000;
    Scanner sc = new Scanner(System.in);

    public int getMoney() {
        return money;
    }

    public int tellMembers() {
        System.out.print("👉 何名様ですか?: ");
        return sc.nextInt();
    }

    public HashMap<Integer, Integer> sayOrder(ArrayList<Menu> menu) {

        HashMap<Integer, Integer> orders = new HashMap<>();

        while (true) {
            System.out.println("\n1️⃣ 注文する  2️⃣ 終了");
            System.out.print("👉 選択: ");
            int choice = sc.nextInt();

            if (choice == 1) {
                System.out.print("👉 商品番号: ");
                int item = sc.nextInt();

                if (item < 1 || item > menu.size()) {
                    System.out.println("❌ 無効");
                    continue;
                }

                System.out.print("👉 数量: ");
                int qty = sc.nextInt();

                orders.put(item, orders.getOrDefault(item, 0) + qty);
                System.out.println("✅ 追加しました!");

            } else if (choice == 2) {
                break;
            }
        }
        return orders;
    }

    public void askBill() {
        System.out.println("🧑‍💼 お会計お願いします。");
    }

    public void paybill(int total) {
        System.out.println("💳 支払い中...");
        money -= total;
        System.out.println("💸 残高: " + money + "円");
    }
}

class Waiter {

    public void sayGreet() {
        System.out.println("👨‍🍳 いらっしゃいませ!");
    }

    public void confirmMembers(int members) {
        System.out.println("👨‍🍳 " + members + "名様ですね。お席へご案内します。");
    }

    public void giveMenu(ArrayList<Menu> menu) {
        System.out.println("📖 メニューになります。");
    }

    public void takeOrder() {
        System.out.println("👨‍🍳 ご注文をお伺いします。");
    }

    public int confirmOrder(HashMap<Integer, Integer> orders, ArrayList<Menu> menu) {

        int total = 0;

        System.out.println("\n━━━━━━━━━━━━━━━━━━━━");
        System.out.println("✅ ご注文確認");

        for (int key : orders.keySet()) {
            Menu m = menu.get(key - 1);
            int qty = orders.get(key);

            System.out.println("🍽️ 「" + m.getName() + "」× " + qty);
            total += m.getPrice() * qty;
        }

        System.out.println("━━━━━━━━━━━━━━━━━━━━");
        return total;
    }

    public void sayThanks() {
        System.out.println("🙏 ありがとうございました!またお越しください!");
    }
}
004

Student Management System

A console app for managing student records — add new students, list everyone on file, or search by name or country — with all data persisted to a CSV file between sessions.

Java File I/O ArrayList

⚙️ Key Features

  • Add a student with student number, name, age, and country
  • List every registered student
  • Search students by a partial, case-insensitive match on name or country
  • Data persists across runs via a CSV file (Students.csv)

📚 What I Learned

  • Separating concerns into Screen (view), StudentDatabase (persistence), and Student (model)
  • Appending to and reading from a CSV file with try-with-resources
  • Handling a missing data file gracefully on first run
School.java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Scanner;

public class School {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        StudentDatabase sd = new StudentDatabase();
        Screen view = new Screen();

        while (true) {
            System.out.println("\n1. Student List  2. Student Details  3. Add Student  0. End");
            int menu = sc.nextInt();
            sc.nextLine();

            if (menu == 1) {
                ArrayList<Student> students = sd.getStudents();
                view.displayList(students);

            } else if (menu == 2) {
                ArrayList<Student> students = sd.getStudents();
                System.out.println("Enter Name or Country:");
                String word = sc.nextLine();
                view.displayDetails(students, word);

            } else if (menu == 3) {

                Student s = new Student();
                System.out.println("Enter the Student NO:");
                String studentNo = sc.nextLine();

                System.out.println("Enter the name:");
                String name = sc.nextLine();

                System.out.println("Enter the age:");
                int age = sc.nextInt();
                sc.nextLine();

                System.out.println("Enter the country:");
                String country = sc.nextLine();

                s.setStudentNo(studentNo);
                s.setName(name);
                s.setAge(age);
                s.setCountry(country);

                sd.insertData(s);

                System.out.println("✅ Student Added Successfully!");

            } else if (menu == 0) {
                System.out.println("Exiting...");
                break;

            } else {
                System.out.println("❌ Invalid Choice");
            }
        }

    }
}

class Screen {

    public void displayDetails(ArrayList<Student> students, String word) {
        boolean found = false;

        for (Student s : students) {
            if (s.getName().toLowerCase().contains(word.toLowerCase())
                    || s.getCountry().toLowerCase().contains(word.toLowerCase())) {

                System.out.println("[StudentNO] " + s.getStudentNo());
                System.out.println("[Name] " + s.getName());
                System.out.println("[Age] " + s.getAge());
                System.out.println("[Country] " + s.getCountry());
                System.out.println("--------------------------");

                found = true;
            }
        }

        if (!found) {
            System.out.println("No matching student found.");
        }
    }

    public void displayList(ArrayList<Student> students) {
        if (students.isEmpty()) {
            System.out.println("No students found.");
            return;
        }

        for (Student s : students) {
            System.out.println("[StudentNO] " + s.getStudentNo());
            System.out.println("[Name] " + s.getName());
            System.out.println("---------------------");
        }
    }
}

class StudentDatabase {

    public void insertData(Student s) {
        try (FileWriter fw = new FileWriter("Students.csv", true)) {

            fw.write(s.getStudentNo() + "," +
                    s.getName() + "," +
                    s.getAge() + "," +
                    s.getCountry() + "\n");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public ArrayList<Student> getStudents() {

        ArrayList<Student> students = new ArrayList<>();

        try (BufferedReader br = new BufferedReader(new FileReader("Students.csv"))) {

            String line;

            while ((line = br.readLine()) != null) {
                String[] arr = line.split(",");

                if (arr.length < 4)
                    continue;

                Student s = new Student();

                s.setStudentNo(arr[0]);
                s.setName(arr[1]);
                s.setAge(Integer.parseInt(arr[2]));
                s.setCountry(arr[3]);

                students.add(s);
            }

        } catch (Exception e) {
            System.out.println("No data file found yet.");
        }

        return students;
    }
}

class Student {

    private String studentNo;
    private String name;
    private int age;
    private String country;

    public String getStudentNo() { return studentNo; }
    public void setStudentNo(String studentNo) { this.studentNo = studentNo; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public int getAge() { return age; }
    public void setAge(int age) { this.age = age; }
    public String getCountry() { return country; }
    public void setCountry(String country) { this.country = country; }
}
005

Osaka Tourism Website

A multi-page site introducing Osaka's culture, food, and top attractions, complete with a live embedded weather widget and a quick-facts table covering population and highlights.

HTML CSS Weather Widget

⚙️ Key Features

  • Hero section with a full-width image and overlaid intro text
  • Sections covering Osaka's culture, access by shinkansen, must-see spots, and basic facts
  • A live weather widget embedded via external JavaScript
  • In-page navigation to related pages (food culture, attractions) with hover effects

📚 What I Learned

  • Structuring a multi-page site with consistent navigation
  • Layering styled text over a background image with absolute positioning
  • Embedding a third-party JavaScript widget into a static page
osaka.html (snippet)
<div style="position: relative;">
  <img src="osaka.jpg" width="100%">
  <p style="position:absolute;
    top:20px; left:20px;">
    Osaka is a charming, relaxed city...
  </p>
</div>
View Page
006

Ramen Menu Website

A restaurant-style ramen menu page inspired by Ippudo, featuring hover-animated dish cards with images, prices, and short descriptions for each bowl.

HTML CSS UI Design

⚙️ Key Features

  • Menu items displayed as image-and-text cards for each ramen dish
  • Flexbox layout placing dish photos beside name, tagline, and description
  • A hover animation that lifts each card slightly on mouseover
  • Ippudo-inspired branding and typography

📚 What I Learned

  • Building card-based layouts with Flexbox
  • Using CSS transitions and transform for hover interactions
  • Combining imagery and typography to evoke a restaurant brand
ramenp.css (snippet)
.menu-item {
  display: flex;
  gap: 20px;
  transition: 0.3s;
}
.menu-item:hover {
  transform: translateY(-5px);
}
View Page
007

Slot Machine Game

A console-based slot machine game where players bet coins and spin random symbols to win rewards.

Java Random Console

⚙️ Key Features

  • Starts with a 1000-coin balance
  • Player chooses a bet amount before each spin
  • Three random animal symbols are generated per spin
  • Matching all three pays out bet × 100; a non-match subtracts the bet
  • A short delay between symbol reveals for spin-style pacing

📚 What I Learned

  • Generating and comparing random values across an array
  • Using Thread.sleep() to pace output and simulate a spinning reel
  • Validating bets against the current balance
Test14.java
import java.util.Random;
import java.util.Scanner;

public class Test14 {

    public static void main(String[] args) throws Exception {
        Random r = new Random();
        Scanner sc = new Scanner(System.in);

        System.out.println("ASE GAMBLE!!!!");

        String[] animals = { "😺", "🐶", "🦁", "🐎", };
        int[] result = new int[3];

        int money = 1000;

        while (true) {

            System.out.println("BALANCE : " + money);
            System.out.println("YOU CAN CHOOSE AMOUNT PER SPIN");
            int spin = sc.nextInt();
            if (spin > money) {
                System.out.println("INSUFFICIENT BALANCE");
                System.out.println("DO YOU WANNA CONTINUE. 1.YES  2.NO");
                int ans = sc.nextInt();
                if (ans == 2) {
                    System.out.println("THANK YOU FOR PLAYING");
                    break;
                }
                System.out.println("YOU CAN CHOOSE AMOUNT PER SPIN");
                spin = sc.nextInt();
            }
            for (int i = 0; i < 3; i++) {
                int n = r.nextInt(animals.length);
                new Thread().sleep(1000);
                System.out.print(animals[n]);
                result[i] = n;
            }
            System.out.println();

            if (result[0] == result[1] && result[1] == result[2]) {

                System.out.println("YOU WON");
                money = spin * 100;

            } else {
                System.out.println("TRY AGAIN!!");
                money -= spin;
            }
            System.out.println("DO YOU WANNA CONTINUE. 1.YES  2.NO");
            int ans = sc.nextInt();
            if (ans == 2) {
                System.out.println("THANK YOU FOR PLAYING");
                break;
            }
        }

    }
}
008

Rock-Paper-Scissors Betting Game

A betting game where players compete against the computer and gain or lose coins based on results.

Java Game Logic Random

⚙️ Key Features

  • Starts with a 1000-yen balance and tracks win/loss counts
  • Player bets an amount, then picks rock, paper, or scissors
  • The computer's move is chosen at random
  • Win pays triple the bet, loss forfeits the bet, draw leaves the balance unchanged
  • A short 'thinking' animation plays before the result

📚 What I Learned

  • Implementing full win/lose/draw logic with chained conditionals
  • Tracking cumulative stats (wins, losses) across a game loop
  • Adding small delays and emoji to improve the console UX
Test29.java
import java.util.Random;
import java.util.Scanner;

public class Test29 {

    public static void main(String[] args) throws Exception {

        Random r = new Random();
        Scanner sc = new Scanner(System.in);

        System.out.println("✊🖐️✌️ゲーム");

        int money = 1000;
        int win = 0;
        int lose = 0;

        System.out.println("BALANCE:¥" + money);

        while (true) {
            if (money == 0) {
                System.out.println("お金が無くなりました");
                break;
            }

            System.out.println("いっかいいくら賭けますか?");
            int bet = sc.nextInt();

            if (bet > money) {
                System.out.println("お金足りません");
            }

            System.out.println("1:✊グー 2:✌️チョキ 3:🖐️パー");
            int a = sc.nextInt();

            for (int i = 1; i <= 5; i++) {
                System.out.print("🤔");
                new Thread().sleep(500);
            }
            System.out.println();

            int b = r.nextInt(3);

            if (a == 1 && b == 0) {
                System.out.println("DRAW RESULT あなたは✊グー PCも✊グー");
            } else if (a == 1 && b == 1) {
                System.out.println("WIN RESULT あなたは✊グー PCは✌️チョキ");
                money += bet * 3;
                win++;
            } else if (a == 1 && b == 2) {
                System.out.println("LOSE RESULT あなたは✊グー PCも🖐️パー");
                money -= bet;
                lose++;
            } else if (a == 2 && b == 1) {
                System.out.println("DRAW RESULT あなたは✌️チョキー PCも✌️チョキー");
            } else if (a == 2 && b == 2) {
                System.out.println("WIN RESULT あなたは✌️チョキ PCは🖐️パー");
                money += bet * 3;
                win++;
            } else if (a == 2 && b == 0) {
                System.out.println("LOSE RESULT あなたは✌️チョキ PCは✊グー");
                money -= bet;
                lose++;
            } else if (a == 3 && b == 2) {
                System.out.println("DRAW RESULT あなたは🖐️パー PCも🖐️パー");
            } else if (a == 3 && b == 0) {
                System.out.println("WIN RESULT あなたは🖐️パー PCは✊グー");
                money += bet * 3;
                win++;
            } else if (a == 3 && b == 1) {
                System.out.println("LOSE RESULT あなたは🖐️パー PCは✌️チョキー");
                money -= bet;
                lose++;
            }
            System.out.println("お金:¥" + money);

            System.out.println("1:もう一回する 2:終わる");
            int p = sc.nextInt();
            if (p == 2) {
                System.out.println("YOU HAVE ¥" + money);
                System.out.println(win + "回勝ちました");
                System.out.println(lose + "回負けました");
                break;

            }

        }

    }

}
Back to Main Projects