From 5c32e997b983c0600ac5b43e9fee7cb5da6172cd Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 9 Mar 2026 13:25:35 -0400 Subject: [PATCH 01/21] boilerplate --- .../org/codedifferently/BandGigManager.java | 137 ++++++++++++++++++ src/main/java/org/codedifferently/Gig.java | 111 ++++++++++++++ src/main/java/org/codedifferently/Venue.java | 67 +++++++++ 3 files changed, 315 insertions(+) create mode 100644 src/main/java/org/codedifferently/BandGigManager.java create mode 100644 src/main/java/org/codedifferently/Gig.java create mode 100644 src/main/java/org/codedifferently/Venue.java diff --git a/src/main/java/org/codedifferently/BandGigManager.java b/src/main/java/org/codedifferently/BandGigManager.java new file mode 100644 index 0000000..ccc1e3a --- /dev/null +++ b/src/main/java/org/codedifferently/BandGigManager.java @@ -0,0 +1,137 @@ +package org.codedifferently; + +import java.util.ArrayList; +import java.util.Collections; + +public class BandGigManager { + private ArrayList gigs; + private ArrayList songCatalog; + private ArrayList defaultBandMembers; + + public BandGigManager() { + gigs = new ArrayList<>(); + songCatalog = new ArrayList<>(); + defaultBandMembers = new ArrayList<>(); + } + + public void addGig(Gig gig) { + gigs.add(gig); + } + + public ArrayList getGigs() { + return gigs; + } + + public Gig findGigByIndex(int index) { + if (index >= 0 && index < gigs.size()) { + return gigs.get(index); + } + return null; + } + + public void viewAllGigs() { + if (gigs.isEmpty()) { + System.out.println("No gigs available."); + return; + } + + for (int i = 0; i < gigs.size(); i++) { + System.out.println((i + 1) + ". " + gigs.get(i)); + System.out.println(); + } + } + + public void viewUpcomingGigs() { + boolean found = false; + + for (int i = 0; i < gigs.size(); i++) { + if (!gigs.get(i).isCompleted()) { + System.out.println((i + 1) + ". " + gigs.get(i)); + System.out.println(); + found = true; + } + } + + if (!found) { + System.out.println("No upcoming gigs."); + } + } + + public void viewCompletedGigs() { + boolean found = false; + + for (int i = 0; i < gigs.size(); i++) { + if (gigs.get(i).isCompleted()) { + System.out.println((i + 1) + ". " + gigs.get(i)); + System.out.println(); + found = true; + } + } + + if (!found) { + System.out.println("No completed gigs."); + } + } + + public double calculateTotalEarnings() { + double total = 0; + + for (Gig gig : gigs) { + if (gig.isCompleted()) { + total += gig.getPayment(); + } + } + + return total; + } + + public void addSongToCatalog(String song) { + songCatalog.add(song); + } + + public ArrayList getSongCatalog() { + return songCatalog; + } + + public void addDefaultBandMember(String member) { + defaultBandMembers.add(member); + } + + public ArrayList getDefaultBandMembers() { + return defaultBandMembers; + } + + public void applyDefaultLineup(Gig gig) { + gig.getLineup().clear(); + gig.getLineup().addAll(defaultBandMembers); + } + + public void generateSetlistForGig(Gig gig, int numberOfSongs) { + if (songCatalog.isEmpty()) { + System.out.println("Song catalog is empty."); + return; + } + + ArrayList tempSongs = new ArrayList<>(songCatalog); + Collections.shuffle(tempSongs); + + gig.clearSetlist(); + + for (int i = 0; i < numberOfSongs && i < tempSongs.size(); i++) { + gig.addSong(tempSongs.get(i)); + } + } + + public void viewGigDetails(int index) { + Gig gig = findGigByIndex(index); + + if (gig == null) { + System.out.println("Invalid gig selection."); + return; + } + + System.out.println(gig); + System.out.println("Lineup: " + gig.getLineup()); + System.out.println("Setlist: " + gig.getSetlist()); + } +} diff --git a/src/main/java/org/codedifferently/Gig.java b/src/main/java/org/codedifferently/Gig.java new file mode 100644 index 0000000..7e3f400 --- /dev/null +++ b/src/main/java/org/codedifferently/Gig.java @@ -0,0 +1,111 @@ +package org.codedifferently; + +import java.util.ArrayList; + +public class Gig { + private String date; + private Venue venue; + private double payment; + private boolean completed; + private ArrayList lineup; + private ArrayList setlist; + + public Gig() { + lineup = new ArrayList<>(); + setlist = new ArrayList<>(); + completed = false; + } + + public Gig(String date, Venue venue, double payment) { + this.date = date; + this.venue = venue; + this.payment = payment; + this.completed = false; + this.lineup = new ArrayList<>(); + this.setlist = new ArrayList<>(); + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public Venue getVenue() { + return venue; + } + + public void setVenue(Venue venue) { + this.venue = venue; + } + + public double getPayment() { + return payment; + } + + public void setPayment(double payment) { + this.payment = payment; + } + + public boolean isCompleted() { + return completed; + } + + public void setCompleted(boolean completed) { + this.completed = completed; + } + + public ArrayList getLineup() { + return lineup; + } + + public void setLineup(ArrayList lineup) { + this.lineup = lineup; + } + + public ArrayList getSetlist() { + return setlist; + } + + public void setSetlist(ArrayList setlist) { + this.setlist = setlist; + } + + public void addBandMember(String member) { + lineup.add(member); + } + + public void removeBandMember(String member) { + lineup.remove(member); + } + + public void addSong(String song) { + setlist.add(song); + } + + public void clearSetlist() { + setlist.clear(); + } + + public void markCompleted() { + completed = true; + } + + public String getStatus() { + if (completed) { + return "Completed"; + } + return "Scheduled"; + } + + @Override + public String toString() { + return "Date: " + date + + "\nVenue: " + venue.getName() + + "\nCity: " + venue.getCity() + + "\nPayment: $" + payment + + "\nStatus: " + getStatus(); + } +} diff --git a/src/main/java/org/codedifferently/Venue.java b/src/main/java/org/codedifferently/Venue.java new file mode 100644 index 0000000..35e1ad4 --- /dev/null +++ b/src/main/java/org/codedifferently/Venue.java @@ -0,0 +1,67 @@ +package org.codedifferently; + +public class Venue { + private String name; + private String city; + private int capacity; + private String contactName; + private String contactEmail; + + public Venue() { + } + + public Venue(String name, String city, int capacity, String contactName, String contactEmail) { + this.name = name; + this.city = city; + this.capacity = capacity; + this.contactName = contactName; + this.contactEmail = contactEmail; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public int getCapacity() { + return capacity; + } + + public void setCapacity(int capacity) { + this.capacity = capacity; + } + + public String getContactName() { + return contactName; + } + + public void setContactName(String contactName) { + this.contactName = contactName; + } + + public String getContactEmail() { + return contactEmail; + } + + public void setContactEmail(String contactEmail) { + this.contactEmail = contactEmail; + } + + @Override + public String toString() { + return name + " - " + city + " | Capacity: " + capacity + + " | Contact: " + contactName + " | Email: " + contactEmail; + } + } + From 95ebf7dc61870251ab5eae7c91c003874f2d1b1b Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 9 Mar 2026 13:26:14 -0400 Subject: [PATCH 02/21] new branch --- src/main/java/org/codedifferently/Gig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/codedifferently/Gig.java b/src/main/java/org/codedifferently/Gig.java index 7e3f400..303c7dd 100644 --- a/src/main/java/org/codedifferently/Gig.java +++ b/src/main/java/org/codedifferently/Gig.java @@ -109,3 +109,4 @@ public String toString() { "\nStatus: " + getStatus(); } } +// \ No newline at end of file From 7f3409a42754d2fa86ae3a52215e630b80f9021d Mon Sep 17 00:00:00 2001 From: wilfredainsworth Date: Mon, 9 Mar 2026 13:42:03 -0400 Subject: [PATCH 03/21] UI class created. --- .../java/org/codedifferently/BandGigManager.java | 1 - src/main/java/org/codedifferently/Main.java | 12 ++++-------- src/main/java/org/codedifferently/UI.java | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 src/main/java/org/codedifferently/UI.java diff --git a/src/main/java/org/codedifferently/BandGigManager.java b/src/main/java/org/codedifferently/BandGigManager.java index ccc1e3a..c9a8afe 100644 --- a/src/main/java/org/codedifferently/BandGigManager.java +++ b/src/main/java/org/codedifferently/BandGigManager.java @@ -129,7 +129,6 @@ public void viewGigDetails(int index) { System.out.println("Invalid gig selection."); return; } - System.out.println(gig); System.out.println("Lineup: " + gig.getLineup()); System.out.println("Setlist: " + gig.getSetlist()); diff --git a/src/main/java/org/codedifferently/Main.java b/src/main/java/org/codedifferently/Main.java index 435139b..885e38c 100644 --- a/src/main/java/org/codedifferently/Main.java +++ b/src/main/java/org/codedifferently/Main.java @@ -4,14 +4,10 @@ // click the icon in the gutter. public class Main { public static void main(String[] args) { - //TIP Press with your caret at the highlighted text - // to see how IntelliJ IDEA suggests fixing it. - System.out.printf("Hello and welcome!"); - for (int i = 1; i <= 5; i++) { - //TIP Press to start debugging your code. We have set one breakpoint - // for you, but you can always add more by pressing . - System.out.println("i = " + i); + + + + } } -} \ No newline at end of file diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java new file mode 100644 index 0000000..23a9767 --- /dev/null +++ b/src/main/java/org/codedifferently/UI.java @@ -0,0 +1,14 @@ +package org.codedifferently; + +public class UI { + public static void main(String[] args) { + + BandGigManager bgm = new BandGigManager(); + + + System.out.println(); + + + } + +} From f7ba89531407c41d0ca81ec236f8e74381c9b4ca Mon Sep 17 00:00:00 2001 From: wilfredainsworth Date: Mon, 9 Mar 2026 14:47:49 -0400 Subject: [PATCH 04/21] working on UI --- src/main/java/org/codedifferently/UI.java | 60 +++++++++++++++++-- src/main/java/org/codedifferently/Venue.java | 17 ++++++ .../codedifferently/helpers/InputHandler.java | 49 +++++++++++++++ 3 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 src/main/java/org/codedifferently/helpers/InputHandler.java diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index 23a9767..4fd74ad 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -1,14 +1,62 @@ package org.codedifferently; -public class UI { - public static void main(String[] args) { - - BandGigManager bgm = new BandGigManager(); +import java.util.Scanner; +public class UI { - System.out.println(); + BandGigManager bgm = new BandGigManager(); + Gig gig = new Gig(); + Scanner sc = new Scanner(System.in); + Venue venue = new Venue(); + public void startProgram() { + while (true) { + System.out.println("=============OPENING BAND GIG MANAGER==============="); + System.out.println("1. Add New Gig"); + System.out.println("2. View Venue Information"); + System.out.println("3. Mark Gig as Complete"); + System.out.println("4. View Upcoming Gigs"); + System.out.println("5. View Completed Gigs"); + System.out.println("6. View All Gigs"); + System.out.println("7. View Song Catalog"); + System.out.println("8. Generate Setlist"); + System.out.println("9. Calculate Total Earnings"); + System.out.println("===================================================="); + System.out.println("Select option: "); + int choice = sc.nextInt(); + switch (choice) { + case 1: + Venue venue = venue.promptNewVenue(); + System.out.println("Enter date of gig: "); + String date= sc.nextLine(); + System.out.println("How much is gig paying? "); + double payment = sc.nextDouble(); + Gig newGig = new Gig(date,venue,payment); + break; + case 2: + bgm; + break; + case 3: + bgm. + case 4: + bgm.viewUpcomingGigs(); + break; + case 5: + bgm.viewCompletedGigs(); + break; + case 6: bgm.viewAllGigs(); + break; + case7: bgm.getSongCatalog(); + break; + case 9: + bgm.calculateTotalEarnings(); + case 9: + bgm.calculateTotalEarnings(); + default: + System.out.println("Invalid Selection. Please try again"); + } + } } - } + diff --git a/src/main/java/org/codedifferently/Venue.java b/src/main/java/org/codedifferently/Venue.java index 35e1ad4..0cf98d0 100644 --- a/src/main/java/org/codedifferently/Venue.java +++ b/src/main/java/org/codedifferently/Venue.java @@ -1,5 +1,7 @@ package org.codedifferently; +import java.util.Scanner; + public class Venue { private String name; private String city; @@ -7,6 +9,8 @@ public class Venue { private String contactName; private String contactEmail; + Scanner sc = new Scanner(System.in); + public Venue() { } @@ -17,6 +21,19 @@ public Venue(String name, String city, int capacity, String contactName, String this.contactName = contactName; this.contactEmail = contactEmail; } + public Venue promptNewVenue(){ + System.out.println("Enter name of gig venue: "); + String venueName = sc.nextLine(); + System.out.println("Enter name of city/state of venue: "); + String city = sc.nextLine(); + System.out.println("Enter venue capacity: "); + int capacity = sc.nextInt(); + System.out.println("Enter the first and last name of this venue's contact: "); + String contactName=sc.nextLine(); + System.out.println("Enter the email address of this venue's contact: "); + String contactEmail = sc.nextLine(); + return new Venue(venueName,city,capacity,contactName,contactEmail); + } public String getName() { return name; diff --git a/src/main/java/org/codedifferently/helpers/InputHandler.java b/src/main/java/org/codedifferently/helpers/InputHandler.java new file mode 100644 index 0000000..b397763 --- /dev/null +++ b/src/main/java/org/codedifferently/helpers/InputHandler.java @@ -0,0 +1,49 @@ +package org.codedifferently.helpers; + +import java.util.Scanner; + +public class InputHandler { + + public static int handleIntegerInput() { + Scanner scan = new Scanner(System.in); + int scanInput = 0; + boolean validScanInput = false; + //While loop to make sure user puts in the correct input + while(!validScanInput) { + //Call Scanner methods + try { + //Scanner method to collect input + scanInput = scan.nextInt(); + validScanInput = true; + } + catch (Exception e) { + //If user enters invalid input, the catch block will prevent errors. + System.out.println("Invalid input! Try typing a number instead of a String!"); + scan.next(); + } + } + return scanInput; + } + + public static String handleStringInput() { + Scanner scan = new Scanner(System.in); + String scanInput = ""; + boolean validScanInput = false; + //While loop to make sure user puts in the correct input + while(!validScanInput) { + //Call Scanner methods + try { + //Scanner method to collect input + scanInput = scan.nextLine(); + validScanInput = true; + } + catch (Exception e) { + //If user enters invalid input, the catch block will prevent errors. + System.out.println("Invalid input! Try typing a valid String!"); + scan.next(); + } + } + return scanInput; + } + +} From a70a48aff37edd81dd4ad87df6c198c2717f5c31 Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 9 Mar 2026 14:53:00 -0400 Subject: [PATCH 05/21] update UI --- src/main/java/org/codedifferently/UI.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index 23a9767..99682d3 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -1,6 +1,9 @@ package org.codedifferently; public class UI { + + + public static void main(String[] args) { BandGigManager bgm = new BandGigManager(); From 6e2db299557bdba95638edee72f6d385e63dff81 Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 9 Mar 2026 15:20:56 -0400 Subject: [PATCH 06/21] main logic complete --- src/main/java/org/codedifferently/Main.java | 3 +- src/main/java/org/codedifferently/UI.java | 142 +++++++++++++++---- src/main/java/org/codedifferently/Venue.java | 7 +- 3 files changed, 126 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/codedifferently/Main.java b/src/main/java/org/codedifferently/Main.java index 885e38c..22149ab 100644 --- a/src/main/java/org/codedifferently/Main.java +++ b/src/main/java/org/codedifferently/Main.java @@ -5,7 +5,8 @@ public class Main { public static void main(String[] args) { - + UI ui = new UI(); + ui.startProgram(); diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index 4fd74ad..744349a 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -4,13 +4,14 @@ public class UI { - BandGigManager bgm = new BandGigManager(); - Gig gig = new Gig(); - Scanner sc = new Scanner(System.in); - Venue venue = new Venue(); + private BandGigManager bgm = new BandGigManager(); + private Scanner sc = new Scanner(System.in); + public void startProgram() { - while (true) { - System.out.println("=============OPENING BAND GIG MANAGER==============="); + boolean running = true; + + while (running) { + System.out.println("\n============= OPENING BAND GIG MANAGER ============="); System.out.println("1. Add New Gig"); System.out.println("2. View Venue Information"); System.out.println("3. Mark Gig as Complete"); @@ -20,43 +21,136 @@ public void startProgram() { System.out.println("7. View Song Catalog"); System.out.println("8. Generate Setlist"); System.out.println("9. Calculate Total Earnings"); + System.out.println("10. Exit"); System.out.println("===================================================="); + System.out.print("Select option: "); - System.out.println("Select option: "); int choice = sc.nextInt(); + sc.nextLine(); // clears leftover newline switch (choice) { case 1: - Venue venue = venue.promptNewVenue(); - System.out.println("Enter date of gig: "); - String date= sc.nextLine(); - System.out.println("How much is gig paying? "); - double payment = sc.nextDouble(); - Gig newGig = new Gig(date,venue,payment); + addNewGig(); break; + case 2: - bgm; + viewVenueInformation(); break; + case 3: - bgm. + markGigComplete(); + break; + case 4: bgm.viewUpcomingGigs(); break; + case 5: bgm.viewCompletedGigs(); break; - case 6: bgm.viewAllGigs(); - break; - case7: bgm.getSongCatalog(); - break; - case 9: - bgm.calculateTotalEarnings(); + + case 6: + bgm.viewAllGigs(); + break; + + case 7: + viewSongCatalog(); + break; + + case 8: + generateSetlist(); + break; + case 9: - bgm.calculateTotalEarnings(); + System.out.println("Total earnings: $" + bgm.calculateTotalEarnings()); + break; + + case 10: + running = false; + System.out.println("Closing Band Gig Manager..."); + break; + default: - System.out.println("Invalid Selection. Please try again"); + System.out.println("Invalid selection. Please try again."); + } + } + } + + private void addNewGig() { + // Assumes your Venue class has a method like promptNewVenue() + Venue venue = new Venue().promptNewVenue(); + + + System.out.print("Enter date of gig: "); + String date = sc.nextLine(); + + System.out.print("How much is the gig paying? "); + double payment = sc.nextDouble(); + sc.nextLine(); // clear newline + + Gig newGig = new Gig(date, venue, payment); + bgm.addGig(newGig); + + System.out.println("Gig added successfully."); + } + + private void viewVenueInformation() { + System.out.print("Enter gig number to view venue information: "); + int gigIndex = sc.nextInt(); + sc.nextLine(); + + Gig gig = bgm.findGigByIndex(gigIndex - 1); + + if (gig != null) { + System.out.println(gig.getVenue()); + } else { + System.out.println("Invalid gig selection."); + } + } + + private void markGigComplete() { + System.out.print("Enter gig number to mark as completed: "); + int gigIndex = sc.nextInt(); + sc.nextLine(); + + Gig gig = bgm.findGigByIndex(gigIndex - 1); + + if (gig != null) { + gig.markCompleted(); + System.out.println("Gig marked as completed."); + } else { + System.out.println("Invalid gig selection."); + } + } + + private void viewSongCatalog() { + if (bgm.getSongCatalog().isEmpty()) { + System.out.println("Song catalog is empty."); + } else { + System.out.println("Song Catalog:"); + for (int i = 0; i < bgm.getSongCatalog().size(); i++) { + System.out.println((i + 1) + ". " + bgm.getSongCatalog().get(i)); } } } -} + private void generateSetlist() { + System.out.print("Enter gig number to generate a setlist for: "); + int gigIndex = sc.nextInt(); + sc.nextLine(); + + Gig gig = bgm.findGigByIndex(gigIndex - 1); + + if (gig == null) { + System.out.println("Invalid gig selection."); + return; + } + + System.out.print("How many songs should be in the setlist? "); + int numberOfSongs = sc.nextInt(); + sc.nextLine(); + + bgm.generateSetlistForGig(gig, numberOfSongs); + System.out.println("Setlist generated successfully."); + } +} \ No newline at end of file diff --git a/src/main/java/org/codedifferently/Venue.java b/src/main/java/org/codedifferently/Venue.java index 0cf98d0..a354436 100644 --- a/src/main/java/org/codedifferently/Venue.java +++ b/src/main/java/org/codedifferently/Venue.java @@ -24,12 +24,17 @@ public Venue(String name, String city, int capacity, String contactName, String public Venue promptNewVenue(){ System.out.println("Enter name of gig venue: "); String venueName = sc.nextLine(); + System.out.println("Enter name of city/state of venue: "); String city = sc.nextLine(); + System.out.println("Enter venue capacity: "); int capacity = sc.nextInt(); + sc.nextLine(); // CLEAR NEWLINE + System.out.println("Enter the first and last name of this venue's contact: "); - String contactName=sc.nextLine(); + String contactName = sc.nextLine(); + System.out.println("Enter the email address of this venue's contact: "); String contactEmail = sc.nextLine(); return new Venue(venueName,city,capacity,contactName,contactEmail); From f6aa6d6994212bf8606b0064402421f001806d38 Mon Sep 17 00:00:00 2001 From: wilfredainsworth Date: Mon, 9 Mar 2026 15:25:29 -0400 Subject: [PATCH 07/21] fixing merge conflict --- src/main/java/org/codedifferently/Main.java | 4 ++-- src/main/java/org/codedifferently/UI.java | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/codedifferently/Main.java b/src/main/java/org/codedifferently/Main.java index 885e38c..2314a36 100644 --- a/src/main/java/org/codedifferently/Main.java +++ b/src/main/java/org/codedifferently/Main.java @@ -5,8 +5,8 @@ public class Main { public static void main(String[] args) { - - + UI ui= new UI(); + ui.startProgram(); } diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index 4fd74ad..c2832fd 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -20,12 +20,13 @@ public void startProgram() { System.out.println("7. View Song Catalog"); System.out.println("8. Generate Setlist"); System.out.println("9. Calculate Total Earnings"); + System.out.println("0. Close App"); System.out.println("===================================================="); System.out.println("Select option: "); int choice = sc.nextInt(); - switch (choice) { + switch (choice!=0) { case 1: Venue venue = venue.promptNewVenue(); System.out.println("Enter date of gig: "); @@ -33,26 +34,31 @@ public void startProgram() { System.out.println("How much is gig paying? "); double payment = sc.nextDouble(); Gig newGig = new Gig(date,venue,payment); + bgm.addGig(newGig); break; case 2: - bgm; + bgm.viewAllGigs(); break; case 3: bgm. case 4: bgm.viewUpcomingGigs(); + break; case 5: bgm.viewCompletedGigs(); break; case 6: bgm.viewAllGigs(); - break; + break; case7: bgm.getSongCatalog(); - break; - case 9: - bgm.calculateTotalEarnings(); + break; + case 8: + bgm.generateSetlistForGig(); + break; case 9: bgm.calculateTotalEarnings(); + case 0: + choice=0; default: System.out.println("Invalid Selection. Please try again"); } From 7b7b84136ebb5e947a8641bf5bb23eaae4d51380 Mon Sep 17 00:00:00 2001 From: wilfredainsworth Date: Mon, 9 Mar 2026 16:30:32 -0400 Subject: [PATCH 08/21] additional menu edits --- .../org/codedifferently/BandGigManager.java | 20 +++++- src/main/java/org/codedifferently/UI.java | 66 +++++++++++++------ 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/codedifferently/BandGigManager.java b/src/main/java/org/codedifferently/BandGigManager.java index c9a8afe..e9fba77 100644 --- a/src/main/java/org/codedifferently/BandGigManager.java +++ b/src/main/java/org/codedifferently/BandGigManager.java @@ -2,17 +2,35 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.Scanner; public class BandGigManager { private ArrayList gigs; private ArrayList songCatalog; private ArrayList defaultBandMembers; + Scanner sc = new Scanner(System.in); public BandGigManager() { gigs = new ArrayList<>(); songCatalog = new ArrayList<>(); defaultBandMembers = new ArrayList<>(); } + public void addNewGig() { + // Assumes your Venue class has a method like promptNewVenue() + Venue venue = new Venue().promptNewVenue(); + + System.out.print("Enter date of gig: "); + String date = sc.nextLine(); + + System.out.print("How much is the gig paying? "); + double payment = sc.nextDouble(); + sc.nextLine(); // clear newline + + Gig newGig = new Gig(date, venue, payment); + addGig(newGig); + + System.out.println("Gig added successfully."); + } public void addGig(Gig gig) { gigs.add(gig); @@ -87,6 +105,7 @@ public double calculateTotalEarnings() { public void addSongToCatalog(String song) { songCatalog.add(song); + System.out.println("Song "+ song+" added to catalog."); } public ArrayList getSongCatalog() { @@ -111,7 +130,6 @@ public void generateSetlistForGig(Gig gig, int numberOfSongs) { System.out.println("Song catalog is empty."); return; } - ArrayList tempSongs = new ArrayList<>(songCatalog); Collections.shuffle(tempSongs); diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index 744349a..5771fd4 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -6,19 +6,20 @@ public class UI { private BandGigManager bgm = new BandGigManager(); private Scanner sc = new Scanner(System.in); + Gig gig = new Gig(); public void startProgram() { boolean running = true; while (running) { System.out.println("\n============= OPENING BAND GIG MANAGER ============="); - System.out.println("1. Add New Gig"); - System.out.println("2. View Venue Information"); + System.out.println("1. View Gig Information"); + System.out.println("2. Song"); System.out.println("3. Mark Gig as Complete"); System.out.println("4. View Upcoming Gigs"); System.out.println("5. View Completed Gigs"); System.out.println("6. View All Gigs"); - System.out.println("7. View Song Catalog"); + System.out.println("7. Add Song/View Song Catalog"); System.out.println("8. Generate Setlist"); System.out.println("9. Calculate Total Earnings"); System.out.println("10. Exit"); @@ -30,7 +31,7 @@ public void startProgram() { switch (choice) { case 1: - addNewGig(); + showGigMenu(); break; case 2: @@ -54,6 +55,9 @@ public void startProgram() { break; case 7: + System.out.println("Enter name of song to add to catalog: "); + String song = sc.nextLine(); + bgm.addSongToCatalog(song); viewSongCatalog(); break; @@ -76,24 +80,8 @@ public void startProgram() { } } - private void addNewGig() { - // Assumes your Venue class has a method like promptNewVenue() - Venue venue = new Venue().promptNewVenue(); - System.out.print("Enter date of gig: "); - String date = sc.nextLine(); - - System.out.print("How much is the gig paying? "); - double payment = sc.nextDouble(); - sc.nextLine(); // clear newline - - Gig newGig = new Gig(date, venue, payment); - bgm.addGig(newGig); - - System.out.println("Gig added successfully."); - } - private void viewVenueInformation() { System.out.print("Enter gig number to view venue information: "); int gigIndex = sc.nextInt(); @@ -153,4 +141,40 @@ private void generateSetlist() { bgm.generateSetlistForGig(gig, numberOfSongs); System.out.println("Setlist generated successfully."); } -} \ No newline at end of file + + private void showGigMenu() { + + Boolean running = true; + do { + System.out.println("1. Create New Gigs"); + System.out.println("2. View Upcoming Gigs"); + System.out.println("3. View Completed Gigs"); + System.out.println("4. View All Gigs"); + System.out.println("5. Mark Gig Completed"); + System.out.println("0. Exit"); + + int choice = sc.nextInt(); + { + switch (choice) { + case 1: + bgm.addNewGig(); + break; + case 2: + bgm.viewUpcomingGigs(); + break; + case 3: + bgm.viewCompletedGigs(); + break; + case 4: + bgm.viewAllGigs(); + break; + case 5: + markGigComplete(); + case 0: + running=false; + } + + } + }while (running) ; +} + } \ No newline at end of file From fc9aee98cc03c159ea5b27d4e3a9985a3b8f0979 Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 9 Mar 2026 16:50:17 -0400 Subject: [PATCH 09/21] split set/band functionality in UI --- src/main/java/org/codedifferently/UI.java | 80 +++++++++++++---------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index 5771fd4..05904ea 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -13,12 +13,8 @@ public void startProgram() { while (running) { System.out.println("\n============= OPENING BAND GIG MANAGER ============="); - System.out.println("1. View Gig Information"); - System.out.println("2. Song"); - System.out.println("3. Mark Gig as Complete"); - System.out.println("4. View Upcoming Gigs"); - System.out.println("5. View Completed Gigs"); - System.out.println("6. View All Gigs"); + System.out.println("1. Gig Scheduling "); + System.out.println("2. Band and Set Maintenance"); System.out.println("7. Add Song/View Song Catalog"); System.out.println("8. Generate Setlist"); System.out.println("9. Calculate Total Earnings"); @@ -35,41 +31,14 @@ public void startProgram() { break; case 2: - viewVenueInformation(); + showSongMenu(); break; case 3: - markGigComplete(); - break; - - case 4: - bgm.viewUpcomingGigs(); - break; - - case 5: - bgm.viewCompletedGigs(); - break; - - case 6: - bgm.viewAllGigs(); - break; - - case 7: - System.out.println("Enter name of song to add to catalog: "); - String song = sc.nextLine(); - bgm.addSongToCatalog(song); - viewSongCatalog(); - break; - - case 8: - generateSetlist(); - break; - - case 9: System.out.println("Total earnings: $" + bgm.calculateTotalEarnings()); break; - case 10: + case 4: running = false; System.out.println("Closing Band Gig Manager..."); break; @@ -119,6 +88,7 @@ private void viewSongCatalog() { for (int i = 0; i < bgm.getSongCatalog().size(); i++) { System.out.println((i + 1) + ". " + bgm.getSongCatalog().get(i)); } + System.out.println(""); } } @@ -154,6 +124,7 @@ private void showGigMenu() { System.out.println("0. Exit"); int choice = sc.nextInt(); + sc.nextLine(); //clear token { switch (choice) { case 1: @@ -177,4 +148,43 @@ private void showGigMenu() { } }while (running) ; } + + private void showSongMenu() { + + Boolean running = true; + do { + System.out.println("1. Add Song To Catalog"); + System.out.println("2. View Song Catalog"); + System.out.println("3. Adjust Band Lineup for a gig"); + System.out.println("4. Generate Setlist"); + System.out.println("0. Exit"); + + int choice = sc.nextInt(); + sc.nextLine(); // clear token + { + switch (choice) { + case 1: + System.out.println("Enter name of song to add to catalog: "); + String song = sc.nextLine(); + bgm.addSongToCatalog(song); + viewSongCatalog(); + break; + case 2: + viewSongCatalog(); + break; + case 3: + //adjust lineup + bgm.viewCompletedGigs(); + break; + case 4: + generateSetlist(); + break; + //add something to view setlists for a gig + case 0: + running=false; + } + + } + }while (running) ; + } } \ No newline at end of file From 5a01635314f4f8f0a10400093d05219868fbc474 Mon Sep 17 00:00:00 2001 From: wilfredainsworth Date: Mon, 9 Mar 2026 22:02:37 -0400 Subject: [PATCH 10/21] README.md is complete. --- src/main/java/org/codedifferently/README.md | 81 +++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/main/java/org/codedifferently/README.md diff --git a/src/main/java/org/codedifferently/README.md b/src/main/java/org/codedifferently/README.md new file mode 100644 index 0000000..3bbb6c3 --- /dev/null +++ b/src/main/java/org/codedifferently/README.md @@ -0,0 +1,81 @@ +Team Alex, Fred, and Henrietta + + +# BandGigManager: +Bands struggle to track gigs, payments, players, setlists and venues, this application allows them to easily track everything in one spot. + +## THE PLAN + +Our 3 sprints took place over 1 day, March 9th. +During sprint planning, we divided responsibilities as follows: + +Alex was responsible for initial app setup with classes and core methods. +Fred was responsible for input handling and user interfaces(menus) nd README.md . +Henrietta assisted with leaving code comments explaining logic and other discretionary touch-ups. + +We plan to allow users to do the following: +- Add a new gig +- Store and view venue information +- Track payment for each gig +- Mark a gig as completed +- View upcoming gigs +- View total earnings from completed gigs +- Adjust the lineup for a specific gig +- Add songs to a gig’s setlist +- Generate a setlist for a gig from a song catalog +- View full gig details, including venue, status, lineup, and setlist + + +## THE BUILD: + +- Venue +This class will store information about a venue. +Expected fields: +venue name +city +capacity +contact name +contact email + + +- Gig +This class will represent one performance. +Expected fields: +gig ID +event name +date +venue +payment +completion status +lineup +setlist + +- BandGigManager +This class will manage the overall system. +Expected responsibilities: +store all gigs +add gigs +search for a gig +display upcoming gigs +calculate total earnings +store default band members +store a song catalog +generate setlists for gigs + +- UI() +This class handles menus and user prompts with Scanner to keep Main method clean. +This class will run the command-line interface.+ +Show the menu +Get user input with Scanner +Call methods from BandGigManager +Keep the program running until the user exits + +- Main() +Call UI to run program. + +## THE REFLECTION +-Our program is robust and has many capabilities not really necessary given scope of project. We did not need to use Abstraction +since no classes extended parent classes in this program, and no interfaces were needed. Encapsulation is used on Gig, Venue, and BandGigManager +classes with private fields being accessed by getters and setters. + +This program reinforced concepts we've previously implemented. \ No newline at end of file From 714aba55d61947da211d5dcfd03f4c0fc2c58aa6 Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 9 Mar 2026 23:56:31 -0400 Subject: [PATCH 11/21] fixed setlist creation functionality + band lineup functionality in UI, added permissions for completed shows preventing modification --- .../org/codedifferently/BandGigManager.java | 1 + src/main/java/org/codedifferently/Gig.java | 9 + src/main/java/org/codedifferently/README.md | 2 +- src/main/java/org/codedifferently/UI.java | 307 ++++++++++++++++-- src/main/java/org/codedifferently/Venue.java | 29 +- 5 files changed, 287 insertions(+), 61 deletions(-) diff --git a/src/main/java/org/codedifferently/BandGigManager.java b/src/main/java/org/codedifferently/BandGigManager.java index e9fba77..99053f2 100644 --- a/src/main/java/org/codedifferently/BandGigManager.java +++ b/src/main/java/org/codedifferently/BandGigManager.java @@ -140,6 +140,7 @@ public void generateSetlistForGig(Gig gig, int numberOfSongs) { } } + //unused currently public void viewGigDetails(int index) { Gig gig = findGigByIndex(index); diff --git a/src/main/java/org/codedifferently/Gig.java b/src/main/java/org/codedifferently/Gig.java index 303c7dd..26cb544 100644 --- a/src/main/java/org/codedifferently/Gig.java +++ b/src/main/java/org/codedifferently/Gig.java @@ -73,6 +73,7 @@ public void setSetlist(ArrayList setlist) { this.setlist = setlist; } + public void addBandMember(String member) { lineup.add(member); } @@ -100,6 +101,14 @@ public String getStatus() { return "Scheduled"; } + public void swapBandMember(String oldMember, String newMember) { + int index = lineup.indexOf(oldMember); + + if (index != -1) { + lineup.set(index, newMember); + } + } + @Override public String toString() { return "Date: " + date + diff --git a/src/main/java/org/codedifferently/README.md b/src/main/java/org/codedifferently/README.md index 3bbb6c3..1b411c6 100644 --- a/src/main/java/org/codedifferently/README.md +++ b/src/main/java/org/codedifferently/README.md @@ -10,7 +10,7 @@ Our 3 sprints took place over 1 day, March 9th. During sprint planning, we divided responsibilities as follows: Alex was responsible for initial app setup with classes and core methods. -Fred was responsible for input handling and user interfaces(menus) nd README.md . +Fred was responsible for input handling and user interfaces(menus) and README.md . Henrietta assisted with leaving code comments explaining logic and other discretionary touch-ups. We plan to allow users to do the following: diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index 05904ea..4fe720a 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -14,11 +14,10 @@ public void startProgram() { while (running) { System.out.println("\n============= OPENING BAND GIG MANAGER ============="); System.out.println("1. Gig Scheduling "); - System.out.println("2. Band and Set Maintenance"); - System.out.println("7. Add Song/View Song Catalog"); - System.out.println("8. Generate Setlist"); - System.out.println("9. Calculate Total Earnings"); - System.out.println("10. Exit"); + System.out.println("2. Song and Setlist Maintenance"); + System.out.println("3. Band lineup"); + System.out.println("4. Calculate Total Earnings"); + System.out.println("5. Exit"); System.out.println("===================================================="); System.out.print("Select option: "); @@ -34,11 +33,15 @@ public void startProgram() { showSongMenu(); break; + case 3: + adjustGigLineup(); + break; + case 4: System.out.println("Total earnings: $" + bgm.calculateTotalEarnings()); break; - case 4: + case 5: running = false; System.out.println("Closing Band Gig Manager..."); break; @@ -93,7 +96,20 @@ private void viewSongCatalog() { } private void generateSetlist() { - System.out.print("Enter gig number to generate a setlist for: "); + if (bgm.getGigs().isEmpty()) { + System.out.println("No gigs available."); + return; + } + + if (bgm.getSongCatalog().isEmpty()) { + System.out.println("Song catalog is empty."); + return; + } + + System.out.println("Select a gig to generate a setlist for:"); + bgm.viewAllGigs(); + + System.out.print("Enter gig number: "); int gigIndex = sc.nextInt(); sc.nextLine(); @@ -104,17 +120,137 @@ private void generateSetlist() { return; } + if (gig.isCompleted()) { + System.out.println("Cannot generate a setlist for a completed gig."); + return; + } + System.out.print("How many songs should be in the setlist? "); int numberOfSongs = sc.nextInt(); sc.nextLine(); bgm.generateSetlistForGig(gig, numberOfSongs); - System.out.println("Setlist generated successfully."); + + System.out.println("Setlist generated for this gig."); + System.out.println("Setlist: " + gig.getSetlist()); + } + + + + private void viewGigSetlist() { + if (bgm.getGigs().isEmpty()) { + System.out.println("No gigs available."); + return; + } + + System.out.println("Select a gig to view its setlist:"); + bgm.viewAllGigs(); + + System.out.print("Enter gig number: "); + int gigIndex = sc.nextInt(); + sc.nextLine(); + + Gig gig = bgm.findGigByIndex(gigIndex - 1); + + if (gig == null) { + System.out.println("Invalid gig selection."); + return; + } + + if (gig.getSetlist().isEmpty()) { + System.out.println("This gig does not have a setlist yet."); + return; + } + + System.out.println("\nSetlist for " + gig.getDate() + " at " + gig.getVenue().getName() + ":"); + for (int i = 0; i < gig.getSetlist().size(); i++) { + System.out.println((i + 1) + ". " + gig.getSetlist().get(i)); + } + } + + private void addSongToGigSetlist() { + if (bgm.getGigs().isEmpty()) { + System.out.println("No gigs available."); + return; + } + + System.out.println("Select a gig to add a song to:"); + bgm.viewAllGigs(); + + System.out.print("Enter gig number: "); + int gigIndex = sc.nextInt(); + sc.nextLine(); + + Gig gig = bgm.findGigByIndex(gigIndex - 1); + + if (gig == null) { + System.out.println("Invalid gig selection."); + return; + } + + if (gig.isCompleted()) { + System.out.println("Cannot modify the setlist of a completed gig."); + return; + } + + System.out.print("Enter song name to add to this gig's setlist: "); + String song = sc.nextLine(); + + gig.addSong(song); + System.out.println("Song added to this gig's setlist."); + } + + private void removeSongFromGigSetlist() { + if (bgm.getGigs().isEmpty()) { + System.out.println("No gigs available."); + return; + } + + System.out.println("Select a gig to remove a song from:"); + bgm.viewAllGigs(); + + System.out.print("Enter gig number: "); + int gigIndex = sc.nextInt(); + sc.nextLine(); + + Gig gig = bgm.findGigByIndex(gigIndex - 1); + + if (gig == null) { + System.out.println("Invalid gig selection."); + return; + } + + if (gig.isCompleted()) { + System.out.println("Cannot modify the setlist of a completed gig."); + return; + } + + if (gig.getSetlist().isEmpty()) { + System.out.println("This gig does not have a setlist yet."); + return; + } + + System.out.println("Current setlist:"); + for (int i = 0; i < gig.getSetlist().size(); i++) { + System.out.println((i + 1) + ". " + gig.getSetlist().get(i)); + } + + System.out.print("Enter the number of the song to remove: "); + int songIndex = sc.nextInt(); + sc.nextLine(); + + if (songIndex < 1 || songIndex > gig.getSetlist().size()) { + System.out.println("Invalid song selection."); + return; + } + + String removedSong = gig.getSetlist().remove(songIndex - 1); + System.out.println("Removed song: " + removedSong); } private void showGigMenu() { - Boolean running = true; + boolean running = true; do { System.out.println("1. Create New Gigs"); System.out.println("2. View Upcoming Gigs"); @@ -141,6 +277,7 @@ private void showGigMenu() { break; case 5: markGigComplete(); + break; case 0: running=false; } @@ -150,41 +287,139 @@ private void showGigMenu() { } private void showSongMenu() { + boolean running = true; - Boolean running = true; do { + System.out.println("\n========== SONG / LINEUP MENU =========="); System.out.println("1. Add Song To Catalog"); System.out.println("2. View Song Catalog"); - System.out.println("3. Adjust Band Lineup for a gig"); - System.out.println("4. Generate Setlist"); + System.out.println("3. Generate Setlist For A Gig"); + System.out.println("4. View Setlist For A Gig"); + System.out.println("5. Add Song Manually To A Gig Setlist"); + System.out.println("6. Remove Song From A Gig Setlist"); System.out.println("0. Exit"); + System.out.print("Select option: "); int choice = sc.nextInt(); - sc.nextLine(); // clear token - { - switch (choice) { - case 1: - System.out.println("Enter name of song to add to catalog: "); - String song = sc.nextLine(); - bgm.addSongToCatalog(song); - viewSongCatalog(); - break; - case 2: - viewSongCatalog(); - break; - case 3: - //adjust lineup - bgm.viewCompletedGigs(); - break; - case 4: - generateSetlist(); - break; - //add something to view setlists for a gig - case 0: - running=false; - } + sc.nextLine(); + + switch (choice) { + case 1: + System.out.print("Enter name of song to add to catalog: "); + String song = sc.nextLine(); + bgm.addSongToCatalog(song); + System.out.println("Song added to catalog."); + break; + + case 2: + viewSongCatalog(); + break; + + case 3: + generateSetlist(); + break; + + case 4: + viewGigSetlist(); + break; + + case 5: + addSongToGigSetlist(); + break; + case 6: + removeSongFromGigSetlist(); + break; + case 0: + running = false; + break; + + default: + System.out.println("Invalid selection. Please try again."); + } + + } while (running); + } + + private void adjustGigLineup() { + + if (bgm.getGigs().isEmpty()) { + System.out.println("No gigs available."); + return; + } + + System.out.println("Select a gig to adjust lineup for:"); + bgm.viewAllGigs(); + + System.out.print("Enter gig number: "); + int gigIndex = sc.nextInt(); + sc.nextLine(); + + Gig gig = bgm.findGigByIndex(gigIndex - 1); + + if (gig == null) { + System.out.println("Invalid gig selection."); + return; + } + + if (gig.isCompleted()) { + System.out.println("Cannot adjust lineup for a completed gig."); + return; + } + + boolean editing = true; + + while (editing) { + System.out.println("\n===== LINEUP MENU ====="); + System.out.println("Gig: " + gig.getDate() + " at " + gig.getVenue().getName()); + System.out.println("Current Lineup: " + gig.getLineup()); + System.out.println("1. Apply Default Lineup"); + System.out.println("2. Add Band Member"); + System.out.println("3. Remove Band Member"); + System.out.println("4. Swap Band Member"); + System.out.println("5. Return to Main Menu"); + System.out.print("Select option: "); + int choice = sc.nextInt(); + sc.nextLine(); + + switch (choice) { + case 1: + bgm.applyDefaultLineup(gig); + System.out.println("Default lineup applied to this gig."); + break; + + case 2: + System.out.print("Enter member to add: "); + String memberToAdd = sc.nextLine(); + gig.addBandMember(memberToAdd); + System.out.println("Band member added to this gig."); + break; + + case 3: + System.out.print("Enter member to remove: "); + String memberToRemove = sc.nextLine(); + gig.removeBandMember(memberToRemove); + System.out.println("Band member removed from this gig."); + break; + + case 4: + System.out.print("Enter member to replace: "); + String oldMember = sc.nextLine(); + + System.out.print("Enter new member: "); + String newMember = sc.nextLine(); + + gig.swapBandMember(oldMember, newMember); + System.out.println("Band member swapped for this gig."); + break; + + case 5: + editing = false; + break; + + default: + System.out.println("Invalid selection."); } - }while (running) ; + } } } \ No newline at end of file diff --git a/src/main/java/org/codedifferently/Venue.java b/src/main/java/org/codedifferently/Venue.java index a354436..c4c4f71 100644 --- a/src/main/java/org/codedifferently/Venue.java +++ b/src/main/java/org/codedifferently/Venue.java @@ -6,20 +6,18 @@ public class Venue { private String name; private String city; private int capacity; - private String contactName; - private String contactEmail; + Scanner sc = new Scanner(System.in); public Venue() { } - public Venue(String name, String city, int capacity, String contactName, String contactEmail) { + public Venue(String name, String city, int capacity) { this.name = name; this.city = city; this.capacity = capacity; - this.contactName = contactName; - this.contactEmail = contactEmail; + } public Venue promptNewVenue(){ System.out.println("Enter name of gig venue: "); @@ -32,12 +30,8 @@ public Venue promptNewVenue(){ int capacity = sc.nextInt(); sc.nextLine(); // CLEAR NEWLINE - System.out.println("Enter the first and last name of this venue's contact: "); - String contactName = sc.nextLine(); - System.out.println("Enter the email address of this venue's contact: "); - String contactEmail = sc.nextLine(); - return new Venue(venueName,city,capacity,contactName,contactEmail); + return new Venue(venueName,city,capacity); } public String getName() { @@ -64,26 +58,13 @@ public void setCapacity(int capacity) { this.capacity = capacity; } - public String getContactName() { - return contactName; - } - public void setContactName(String contactName) { - this.contactName = contactName; - } - public String getContactEmail() { - return contactEmail; - } - public void setContactEmail(String contactEmail) { - this.contactEmail = contactEmail; - } @Override public String toString() { - return name + " - " + city + " | Capacity: " + capacity + - " | Contact: " + contactName + " | Email: " + contactEmail; + return name + " - " + city + " | Capacity: " + capacity; } } From 7874ad17a742946282d8896fb9d7a8f195115793 Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 00:38:31 -0400 Subject: [PATCH 12/21] added input handling, refactored UI, BandGigManager and Venue to be more specialized --- .../org/codedifferently/BandGigManager.java | 76 ++-- src/main/java/org/codedifferently/Gig.java | 7 + src/main/java/org/codedifferently/UI.java | 419 +++++++++--------- src/main/java/org/codedifferently/Venue.java | 89 ++-- .../codedifferently/helpers/InputHandler.java | 55 +-- 5 files changed, 321 insertions(+), 325 deletions(-) diff --git a/src/main/java/org/codedifferently/BandGigManager.java b/src/main/java/org/codedifferently/BandGigManager.java index 99053f2..159f30a 100644 --- a/src/main/java/org/codedifferently/BandGigManager.java +++ b/src/main/java/org/codedifferently/BandGigManager.java @@ -2,35 +2,17 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.Scanner; public class BandGigManager { - private ArrayList gigs; - private ArrayList songCatalog; - private ArrayList defaultBandMembers; - Scanner sc = new Scanner(System.in); + private final ArrayList gigs; + private final ArrayList songCatalog; + private final ArrayList defaultBandMembers; public BandGigManager() { gigs = new ArrayList<>(); songCatalog = new ArrayList<>(); defaultBandMembers = new ArrayList<>(); } - public void addNewGig() { - // Assumes your Venue class has a method like promptNewVenue() - Venue venue = new Venue().promptNewVenue(); - - System.out.print("Enter date of gig: "); - String date = sc.nextLine(); - - System.out.print("How much is the gig paying? "); - double payment = sc.nextDouble(); - sc.nextLine(); // clear newline - - Gig newGig = new Gig(date, venue, payment); - addGig(newGig); - - System.out.println("Gig added successfully."); - } public void addGig(Gig gig) { gigs.add(gig); @@ -47,6 +29,17 @@ public Gig findGigByIndex(int index) { return null; } + public boolean markGigCompleteByIndex(int index) { + Gig gig = findGigByIndex(index); + + if (gig == null) { + return false; + } + + gig.markCompleted(); + return true; + } + public void viewAllGigs() { if (gigs.isEmpty()) { System.out.println("No gigs available."); @@ -92,7 +85,7 @@ public void viewCompletedGigs() { } public double calculateTotalEarnings() { - double total = 0; + double total = 0.0; for (Gig gig : gigs) { if (gig.isCompleted()) { @@ -105,7 +98,6 @@ public double calculateTotalEarnings() { public void addSongToCatalog(String song) { songCatalog.add(song); - System.out.println("Song "+ song+" added to catalog."); } public ArrayList getSongCatalog() { @@ -127,9 +119,9 @@ public void applyDefaultLineup(Gig gig) { public void generateSetlistForGig(Gig gig, int numberOfSongs) { if (songCatalog.isEmpty()) { - System.out.println("Song catalog is empty."); return; } + ArrayList tempSongs = new ArrayList<>(songCatalog); Collections.shuffle(tempSongs); @@ -140,7 +132,38 @@ public void generateSetlistForGig(Gig gig, int numberOfSongs) { } } - //unused currently + public boolean generateSetlistForGigByIndex(int index, int numberOfSongs) { + Gig gig = findGigByIndex(index); + + if (gig == null || gig.isCompleted() || songCatalog.isEmpty()) { + return false; + } + + generateSetlistForGig(gig, numberOfSongs); + return true; + } + + public boolean addSongToGigSetlist(int gigIndex, String song) { + Gig gig = findGigByIndex(gigIndex); + + if (gig == null || gig.isCompleted()) { + return false; + } + + gig.addSong(song); + return true; + } + + public String removeSongFromGigSetlist(int gigIndex, int songIndex) { + Gig gig = findGigByIndex(gigIndex); + + if (gig == null || gig.isCompleted()) { + return null; + } + + return gig.removeSongAtIndex(songIndex); + } + public void viewGigDetails(int index) { Gig gig = findGigByIndex(index); @@ -148,8 +171,9 @@ public void viewGigDetails(int index) { System.out.println("Invalid gig selection."); return; } + System.out.println(gig); System.out.println("Lineup: " + gig.getLineup()); System.out.println("Setlist: " + gig.getSetlist()); } -} +} \ No newline at end of file diff --git a/src/main/java/org/codedifferently/Gig.java b/src/main/java/org/codedifferently/Gig.java index 26cb544..92fed97 100644 --- a/src/main/java/org/codedifferently/Gig.java +++ b/src/main/java/org/codedifferently/Gig.java @@ -109,6 +109,13 @@ public void swapBandMember(String oldMember, String newMember) { } } + public String removeSongAtIndex(int index) { + if (index >= 0 && index < setlist.size()) { + return setlist.remove(index); + } + return null; + } + @Override public String toString() { return "Date: " + date + diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index 4fe720a..870c40f 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -1,97 +1,216 @@ package org.codedifferently; +import org.codedifferently.helpers.InputHandler; + import java.util.Scanner; public class UI { - private BandGigManager bgm = new BandGigManager(); - private Scanner sc = new Scanner(System.in); - Gig gig = new Gig(); + private final BandGigManager bgm = new BandGigManager(); + private final Scanner sc = new Scanner(System.in); public void startProgram() { boolean running = true; while (running) { System.out.println("\n============= OPENING BAND GIG MANAGER ============="); - System.out.println("1. Gig Scheduling "); + System.out.println("1. Gig Scheduling"); System.out.println("2. Song and Setlist Maintenance"); - System.out.println("3. Band lineup"); + System.out.println("3. Band Lineup"); System.out.println("4. Calculate Total Earnings"); System.out.println("5. Exit"); System.out.println("===================================================="); System.out.print("Select option: "); - int choice = sc.nextInt(); - sc.nextLine(); // clears leftover newline + int choice = InputHandler.handleIntegerInput(sc); switch (choice) { case 1: showGigMenu(); break; - case 2: showSongMenu(); break; - - case 3: - adjustGigLineup(); + adjustGigLineupMenu(); break; case 4: System.out.println("Total earnings: $" + bgm.calculateTotalEarnings()); break; - case 5: running = false; System.out.println("Closing Band Gig Manager..."); break; - default: System.out.println("Invalid selection. Please try again."); } } } + private void showGigMenu() { + boolean running = true; + do { + System.out.println("\n============== GIG MENU =============="); + System.out.println("1. Create New Gig"); + System.out.println("2. View Upcoming Gigs"); + System.out.println("3. View Completed Gigs"); + System.out.println("4. View All Gigs"); + System.out.println("5. View Venue Information"); + System.out.println("6. Mark Gig Completed"); + System.out.println("0. Exit"); + System.out.println("======================================"); + System.out.print("Select option: "); - private void viewVenueInformation() { - System.out.print("Enter gig number to view venue information: "); - int gigIndex = sc.nextInt(); - sc.nextLine(); + int choice = InputHandler.handleIntegerInput(sc); - Gig gig = bgm.findGigByIndex(gigIndex - 1); + switch (choice) { + case 1: + addNewGig(); + break; + case 2: + bgm.viewUpcomingGigs(); + break; + case 3: + bgm.viewCompletedGigs(); + break; + case 4: + bgm.viewAllGigs(); + break; + case 5: + viewVenueInformation(); + break; + case 6: + markGigComplete(); + break; + case 0: + running = false; + break; + default: + System.out.println("Invalid selection. Please try again."); + } + } while (running); + } - if (gig != null) { - System.out.println(gig.getVenue()); - } else { - System.out.println("Invalid gig selection."); + private void showSongMenu() { + boolean running = true; + + do { + System.out.println("\n========== SONG / SETLIST MENU =========="); + System.out.println("1. Add Song To Catalog"); + System.out.println("2. View Song Catalog"); + System.out.println("3. Generate Setlist For A Gig"); + System.out.println("4. View Setlist For A Gig"); + System.out.println("5. Add Song Manually To A Gig Setlist"); + System.out.println("6. Remove Song From A Gig Setlist"); + System.out.println("0. Exit"); + System.out.println("========================================="); + System.out.print("Select option: "); + + int choice = InputHandler.handleIntegerInput(sc); + + switch (choice) { + case 1: + addSongToCatalog(); + break; + case 2: + viewSongCatalog(); + break; + case 3: + generateSetlist(); + break; + case 4: + viewGigSetlist(); + break; + case 5: + addSongToGigSetlist(); + break; + case 6: + removeSongFromGigSetlist(); + break; + case 0: + running = false; + break; + default: + System.out.println("Invalid selection. Please try again."); + } + } while (running); + } + private void addNewGig() { + System.out.print("Enter name of gig venue: "); + String venueName = InputHandler.handleStringInput(sc); + + System.out.print("Enter city/state of venue: "); + String city = InputHandler.handleStringInput(sc); + + System.out.print("Enter venue capacity: "); + int capacity = InputHandler.handleIntegerInput(sc); + + Venue venue = new Venue(venueName, city, capacity); + + System.out.print("Enter date of gig: "); + String date = InputHandler.handleStringInput(sc); + + System.out.print("How much is the gig paying? "); + double payment = InputHandler.handleDoubleInput(sc); + + Gig newGig = new Gig(date, venue, payment); + bgm.addGig(newGig); + + System.out.println("Gig added successfully."); + } + + private void viewVenueInformation() { + if (bgm.getGigs().isEmpty()) { + System.out.println("No gigs available."); + return; + } + + int gigIndex = promptForGigIndex("Enter gig number to view venue information: "); + if (gigIndex == -1) { + return; } + + Gig gig = bgm.findGigByIndex(gigIndex); + System.out.println(gig.getVenue()); } private void markGigComplete() { - System.out.print("Enter gig number to mark as completed: "); - int gigIndex = sc.nextInt(); - sc.nextLine(); + if (bgm.getGigs().isEmpty()) { + System.out.println("No gigs available."); + return; + } - Gig gig = bgm.findGigByIndex(gigIndex - 1); + int gigIndex = promptForGigIndex("Enter gig number to mark as completed: "); + if (gigIndex == -1) { + return; + } - if (gig != null) { - gig.markCompleted(); + boolean success = bgm.markGigCompleteByIndex(gigIndex); + + if (success) { System.out.println("Gig marked as completed."); } else { System.out.println("Invalid gig selection."); } } + private void addSongToCatalog() { + System.out.print("Enter name of song to add to catalog: "); + String song = InputHandler.handleStringInput(sc); + bgm.addSongToCatalog(song); + System.out.println("Song added to catalog."); + } + private void viewSongCatalog() { if (bgm.getSongCatalog().isEmpty()) { System.out.println("Song catalog is empty."); - } else { - System.out.println("Song Catalog:"); - for (int i = 0; i < bgm.getSongCatalog().size(); i++) { - System.out.println((i + 1) + ". " + bgm.getSongCatalog().get(i)); - } - System.out.println(""); + return; + } + + System.out.println("Song Catalog:"); + for (int i = 0; i < bgm.getSongCatalog().size(); i++) { + System.out.println((i + 1) + ". " + bgm.getSongCatalog().get(i)); } } @@ -109,34 +228,26 @@ private void generateSetlist() { System.out.println("Select a gig to generate a setlist for:"); bgm.viewAllGigs(); - System.out.print("Enter gig number: "); - int gigIndex = sc.nextInt(); - sc.nextLine(); - - Gig gig = bgm.findGigByIndex(gigIndex - 1); - - if (gig == null) { - System.out.println("Invalid gig selection."); - return; - } - - if (gig.isCompleted()) { - System.out.println("Cannot generate a setlist for a completed gig."); + int gigIndex = promptForGigIndex("Enter gig number: "); + if (gigIndex == -1) { return; } System.out.print("How many songs should be in the setlist? "); - int numberOfSongs = sc.nextInt(); - sc.nextLine(); + int numberOfSongs = InputHandler.handleIntegerInput(sc); - bgm.generateSetlistForGig(gig, numberOfSongs); + boolean success = bgm.generateSetlistForGigByIndex(gigIndex, numberOfSongs); + + if (!success) { + System.out.println("Could not generate setlist. The gig may be invalid or already completed."); + return; + } + Gig gig = bgm.findGigByIndex(gigIndex); System.out.println("Setlist generated for this gig."); System.out.println("Setlist: " + gig.getSetlist()); } - - private void viewGigSetlist() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); @@ -146,17 +257,13 @@ private void viewGigSetlist() { System.out.println("Select a gig to view its setlist:"); bgm.viewAllGigs(); - System.out.print("Enter gig number: "); - int gigIndex = sc.nextInt(); - sc.nextLine(); - - Gig gig = bgm.findGigByIndex(gigIndex - 1); - - if (gig == null) { - System.out.println("Invalid gig selection."); + int gigIndex = promptForGigIndex("Enter gig number: "); + if (gigIndex == -1) { return; } + Gig gig = bgm.findGigByIndex(gigIndex); + if (gig.getSetlist().isEmpty()) { System.out.println("This gig does not have a setlist yet."); return; @@ -177,27 +284,21 @@ private void addSongToGigSetlist() { System.out.println("Select a gig to add a song to:"); bgm.viewAllGigs(); - System.out.print("Enter gig number: "); - int gigIndex = sc.nextInt(); - sc.nextLine(); - - Gig gig = bgm.findGigByIndex(gigIndex - 1); - - if (gig == null) { - System.out.println("Invalid gig selection."); - return; - } - - if (gig.isCompleted()) { - System.out.println("Cannot modify the setlist of a completed gig."); + int gigIndex = promptForGigIndex("Enter gig number: "); + if (gigIndex == -1) { return; } System.out.print("Enter song name to add to this gig's setlist: "); - String song = sc.nextLine(); + String song = InputHandler.handleStringInput(sc); + + boolean success = bgm.addSongToGigSetlist(gigIndex, song); - gig.addSong(song); - System.out.println("Song added to this gig's setlist."); + if (success) { + System.out.println("Song added to this gig's setlist."); + } else { + System.out.println("Cannot modify the setlist of a completed or invalid gig."); + } } private void removeSongFromGigSetlist() { @@ -209,21 +310,12 @@ private void removeSongFromGigSetlist() { System.out.println("Select a gig to remove a song from:"); bgm.viewAllGigs(); - System.out.print("Enter gig number: "); - int gigIndex = sc.nextInt(); - sc.nextLine(); - - Gig gig = bgm.findGigByIndex(gigIndex - 1); - - if (gig == null) { - System.out.println("Invalid gig selection."); + int gigIndex = promptForGigIndex("Enter gig number: "); + if (gigIndex == -1) { return; } - if (gig.isCompleted()) { - System.out.println("Cannot modify the setlist of a completed gig."); - return; - } + Gig gig = bgm.findGigByIndex(gigIndex); if (gig.getSetlist().isEmpty()) { System.out.println("This gig does not have a setlist yet."); @@ -236,112 +328,18 @@ private void removeSongFromGigSetlist() { } System.out.print("Enter the number of the song to remove: "); - int songIndex = sc.nextInt(); - sc.nextLine(); - - if (songIndex < 1 || songIndex > gig.getSetlist().size()) { - System.out.println("Invalid song selection."); - return; - } - - String removedSong = gig.getSetlist().remove(songIndex - 1); - System.out.println("Removed song: " + removedSong); - } - - private void showGigMenu() { - - boolean running = true; - do { - System.out.println("1. Create New Gigs"); - System.out.println("2. View Upcoming Gigs"); - System.out.println("3. View Completed Gigs"); - System.out.println("4. View All Gigs"); - System.out.println("5. Mark Gig Completed"); - System.out.println("0. Exit"); + int songIndex = InputHandler.handleIntegerInput(sc); - int choice = sc.nextInt(); - sc.nextLine(); //clear token - { - switch (choice) { - case 1: - bgm.addNewGig(); - break; - case 2: - bgm.viewUpcomingGigs(); - break; - case 3: - bgm.viewCompletedGigs(); - break; - case 4: - bgm.viewAllGigs(); - break; - case 5: - markGigComplete(); - break; - case 0: - running=false; - } + String removedSong = bgm.removeSongFromGigSetlist(gigIndex, songIndex - 1); + if (removedSong == null) { + System.out.println("Could not remove song. The gig may be completed or the selection was invalid."); + } else { + System.out.println("Removed song: " + removedSong); } - }while (running) ; -} - - private void showSongMenu() { - boolean running = true; - - do { - System.out.println("\n========== SONG / LINEUP MENU =========="); - System.out.println("1. Add Song To Catalog"); - System.out.println("2. View Song Catalog"); - System.out.println("3. Generate Setlist For A Gig"); - System.out.println("4. View Setlist For A Gig"); - System.out.println("5. Add Song Manually To A Gig Setlist"); - System.out.println("6. Remove Song From A Gig Setlist"); - System.out.println("0. Exit"); - System.out.print("Select option: "); - - int choice = sc.nextInt(); - sc.nextLine(); - - switch (choice) { - case 1: - System.out.print("Enter name of song to add to catalog: "); - String song = sc.nextLine(); - bgm.addSongToCatalog(song); - System.out.println("Song added to catalog."); - break; - - case 2: - viewSongCatalog(); - break; - - case 3: - generateSetlist(); - break; - - case 4: - viewGigSetlist(); - break; - - case 5: - addSongToGigSetlist(); - break; - case 6: - removeSongFromGigSetlist(); - break; - case 0: - running = false; - break; - - default: - System.out.println("Invalid selection. Please try again."); - } - - } while (running); } - private void adjustGigLineup() { - + private void adjustGigLineupMenu() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); return; @@ -350,17 +348,13 @@ private void adjustGigLineup() { System.out.println("Select a gig to adjust lineup for:"); bgm.viewAllGigs(); - System.out.print("Enter gig number: "); - int gigIndex = sc.nextInt(); - sc.nextLine(); - - Gig gig = bgm.findGigByIndex(gigIndex - 1); - - if (gig == null) { - System.out.println("Invalid gig selection."); + int gigIndex = promptForGigIndex("Enter gig number: "); + if (gigIndex == -1) { return; } + Gig gig = bgm.findGigByIndex(gigIndex); + if (gig.isCompleted()) { System.out.println("Cannot adjust lineup for a completed gig."); return; @@ -379,47 +373,54 @@ private void adjustGigLineup() { System.out.println("5. Return to Main Menu"); System.out.print("Select option: "); - int choice = sc.nextInt(); - sc.nextLine(); + int choice = InputHandler.handleIntegerInput(sc); switch (choice) { case 1: bgm.applyDefaultLineup(gig); System.out.println("Default lineup applied to this gig."); break; - case 2: System.out.print("Enter member to add: "); - String memberToAdd = sc.nextLine(); + String memberToAdd = InputHandler.handleStringInput(sc); gig.addBandMember(memberToAdd); System.out.println("Band member added to this gig."); break; - case 3: System.out.print("Enter member to remove: "); - String memberToRemove = sc.nextLine(); + String memberToRemove = InputHandler.handleStringInput(sc); gig.removeBandMember(memberToRemove); System.out.println("Band member removed from this gig."); break; - case 4: System.out.print("Enter member to replace: "); - String oldMember = sc.nextLine(); + String oldMember = InputHandler.handleStringInput(sc); System.out.print("Enter new member: "); - String newMember = sc.nextLine(); + String newMember = InputHandler.handleStringInput(sc); gig.swapBandMember(oldMember, newMember); System.out.println("Band member swapped for this gig."); break; - case 5: editing = false; break; - default: System.out.println("Invalid selection."); } } } - } \ No newline at end of file + + private int promptForGigIndex(String prompt) { + System.out.print(prompt); + int gigNumber = InputHandler.handleIntegerInput(sc); + + Gig gig = bgm.findGigByIndex(gigNumber - 1); + if (gig == null) { + System.out.println("Invalid gig selection."); + return -1; + } + + return gigNumber - 1; + } +} \ No newline at end of file diff --git a/src/main/java/org/codedifferently/Venue.java b/src/main/java/org/codedifferently/Venue.java index c4c4f71..ecb9d5f 100644 --- a/src/main/java/org/codedifferently/Venue.java +++ b/src/main/java/org/codedifferently/Venue.java @@ -1,70 +1,45 @@ package org.codedifferently; -import java.util.Scanner; - public class Venue { - private String name; - private String city; - private int capacity; - - - Scanner sc = new Scanner(System.in); - - public Venue() { - } - - public Venue(String name, String city, int capacity) { - this.name = name; - this.city = city; - this.capacity = capacity; - - } - public Venue promptNewVenue(){ - System.out.println("Enter name of gig venue: "); - String venueName = sc.nextLine(); - - System.out.println("Enter name of city/state of venue: "); - String city = sc.nextLine(); - - System.out.println("Enter venue capacity: "); - int capacity = sc.nextInt(); - sc.nextLine(); // CLEAR NEWLINE - - - return new Venue(venueName,city,capacity); - } - - public String getName() { - return name; - } + private String name; + private String city; + private int capacity; - public void setName(String name) { - this.name = name; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } + public Venue() { + } - public int getCapacity() { - return capacity; - } + public Venue(String name, String city, int capacity) { + this.name = name; + this.city = city; + this.capacity = capacity; + } - public void setCapacity(int capacity) { - this.capacity = capacity; - } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getCity() { + return city; + } + public void setCity(String city) { + this.city = city; + } + public int getCapacity() { + return capacity; + } - @Override - public String toString() { - return name + " - " + city + " | Capacity: " + capacity; - } + public void setCapacity(int capacity) { + this.capacity = capacity; } + @Override + public String toString() { + return name + " - " + city + " | Capacity: " + capacity; + } +} \ No newline at end of file diff --git a/src/main/java/org/codedifferently/helpers/InputHandler.java b/src/main/java/org/codedifferently/helpers/InputHandler.java index b397763..b320d06 100644 --- a/src/main/java/org/codedifferently/helpers/InputHandler.java +++ b/src/main/java/org/codedifferently/helpers/InputHandler.java @@ -4,46 +4,35 @@ public class InputHandler { - public static int handleIntegerInput() { - Scanner scan = new Scanner(System.in); - int scanInput = 0; - boolean validScanInput = false; - //While loop to make sure user puts in the correct input - while(!validScanInput) { - //Call Scanner methods + public static int handleIntegerInput(Scanner scan) { + while (true) { try { - //Scanner method to collect input - scanInput = scan.nextInt(); - validScanInput = true; - } - catch (Exception e) { - //If user enters invalid input, the catch block will prevent errors. - System.out.println("Invalid input! Try typing a number instead of a String!"); - scan.next(); + int input = Integer.parseInt(scan.nextLine()); + return input; + } catch (NumberFormatException e) { + System.out.println("Invalid input! Please enter a whole number."); } } - return scanInput; } - public static String handleStringInput() { - Scanner scan = new Scanner(System.in); - String scanInput = ""; - boolean validScanInput = false; - //While loop to make sure user puts in the correct input - while(!validScanInput) { - //Call Scanner methods + public static double handleDoubleInput(Scanner scan) { + while (true) { try { - //Scanner method to collect input - scanInput = scan.nextLine(); - validScanInput = true; - } - catch (Exception e) { - //If user enters invalid input, the catch block will prevent errors. - System.out.println("Invalid input! Try typing a valid String!"); - scan.next(); + double input = Double.parseDouble(scan.nextLine()); + return input; + } catch (NumberFormatException e) { + System.out.println("Invalid input! Please enter a valid number."); } } - return scanInput; } -} + public static String handleStringInput(Scanner scan) { + while (true) { + String input = scan.nextLine().trim(); + if (!input.isEmpty()) { + return input; + } + System.out.println("Invalid input! Please enter a non-empty value."); + } + } +} \ No newline at end of file From 840e4590aa48af3c8a2e1fc0bc7dbc2792090824 Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 00:44:08 -0400 Subject: [PATCH 13/21] fixed default band lineup --- src/main/java/org/codedifferently/BandGigManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/codedifferently/BandGigManager.java b/src/main/java/org/codedifferently/BandGigManager.java index 159f30a..1453a6c 100644 --- a/src/main/java/org/codedifferently/BandGigManager.java +++ b/src/main/java/org/codedifferently/BandGigManager.java @@ -12,6 +12,10 @@ public BandGigManager() { gigs = new ArrayList<>(); songCatalog = new ArrayList<>(); defaultBandMembers = new ArrayList<>(); + defaultBandMembers.add("Alex"); + defaultBandMembers.add("Jonny"); + defaultBandMembers.add("Bailey"); + defaultBandMembers.add("Matty"); } public void addGig(Gig gig) { From 0365afa3d4b6873dab5277ec78c3e43f78873fb3 Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 01:02:48 -0400 Subject: [PATCH 14/21] added way to view details like set and lineup for a gig --- src/main/java/org/codedifferently/UI.java | 31 ++++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index 870c40f..f77a8d6 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -18,7 +18,7 @@ public void startProgram() { System.out.println("2. Song and Setlist Maintenance"); System.out.println("3. Band Lineup"); System.out.println("4. Calculate Total Earnings"); - System.out.println("5. Exit"); + System.out.println("0. Exit"); System.out.println("===================================================="); System.out.print("Select option: "); @@ -37,7 +37,7 @@ public void startProgram() { case 4: System.out.println("Total earnings: $" + bgm.calculateTotalEarnings()); break; - case 5: + case 0: running = false; System.out.println("Closing Band Gig Manager..."); break; @@ -56,7 +56,7 @@ private void showGigMenu() { System.out.println("2. View Upcoming Gigs"); System.out.println("3. View Completed Gigs"); System.out.println("4. View All Gigs"); - System.out.println("5. View Venue Information"); + System.out.println("5. View Gig Details"); System.out.println("6. Mark Gig Completed"); System.out.println("0. Exit"); System.out.println("======================================"); @@ -78,7 +78,7 @@ private void showGigMenu() { bgm.viewAllGigs(); break; case 5: - viewVenueInformation(); + viewGigDetails(); break; case 6: markGigComplete(); @@ -262,6 +262,8 @@ private void viewGigSetlist() { return; } + + Gig gig = bgm.findGigByIndex(gigIndex); if (gig.getSetlist().isEmpty()) { @@ -275,6 +277,23 @@ private void viewGigSetlist() { } } + private void viewGigDetails() { + if (bgm.getGigs().isEmpty()) { + System.out.println("No gigs available."); + return; + } + + System.out.println("Select a gig to view details:"); + bgm.viewAllGigs(); + + int gigIndex = promptForGigIndex("Enter gig number: "); + if (gigIndex == -1) { + return; + } + + bgm.viewGigDetails(gigIndex); + } + private void addSongToGigSetlist() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); @@ -370,7 +389,7 @@ private void adjustGigLineupMenu() { System.out.println("2. Add Band Member"); System.out.println("3. Remove Band Member"); System.out.println("4. Swap Band Member"); - System.out.println("5. Return to Main Menu"); + System.out.println("0. Return to Main Menu"); System.out.print("Select option: "); int choice = InputHandler.handleIntegerInput(sc); @@ -402,7 +421,7 @@ private void adjustGigLineupMenu() { gig.swapBandMember(oldMember, newMember); System.out.println("Band member swapped for this gig."); break; - case 5: + case 0: editing = false; break; default: From cb71e8743d1f2d44316b7bc9c4a49aac9df5df64 Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 01:32:44 -0400 Subject: [PATCH 15/21] started comments --- .../org/codedifferently/BandGigManager.java | 4 + src/main/java/org/codedifferently/Main.java | 1 + src/main/java/org/codedifferently/UI.java | 188 ++++++++++-------- 3 files changed, 108 insertions(+), 85 deletions(-) diff --git a/src/main/java/org/codedifferently/BandGigManager.java b/src/main/java/org/codedifferently/BandGigManager.java index 1453a6c..0bc7833 100644 --- a/src/main/java/org/codedifferently/BandGigManager.java +++ b/src/main/java/org/codedifferently/BandGigManager.java @@ -3,7 +3,11 @@ import java.util.ArrayList; import java.util.Collections; +//stores main abstraction of modifier methods we call when we want to update/view/adjust fields in the program public class BandGigManager { + //arraylists used because we need a collection to store objects that is not fixed in size + //needed to be able to easily add and remove objects from list, and access them with indexing + //for this reason ArrayList was a good choice private final ArrayList gigs; private final ArrayList songCatalog; private final ArrayList defaultBandMembers; diff --git a/src/main/java/org/codedifferently/Main.java b/src/main/java/org/codedifferently/Main.java index 22149ab..cc4193a 100644 --- a/src/main/java/org/codedifferently/Main.java +++ b/src/main/java/org/codedifferently/Main.java @@ -5,6 +5,7 @@ public class Main { public static void main(String[] args) { + //all user input logic stored in UI UI ui = new UI(); ui.startProgram(); diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index f77a8d6..de1fb9d 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -4,11 +4,13 @@ import java.util.Scanner; +//houses all user input logic + helper functions for updating gig info public class UI { private final BandGigManager bgm = new BandGigManager(); private final Scanner sc = new Scanner(System.in); + //loop to ask for and collect user input, loop used so it keeps program running until user quits public void startProgram() { boolean running = true; @@ -22,6 +24,7 @@ public void startProgram() { System.out.println("===================================================="); System.out.print("Select option: "); + //uses helper functions in InputHandler to validate user input int choice = InputHandler.handleIntegerInput(sc); switch (choice) { @@ -47,6 +50,7 @@ public void startProgram() { } } + //subdivision to help make menus cleaner private void showGigMenu() { boolean running = true; @@ -92,6 +96,7 @@ private void showGigMenu() { } while (running); } + //subdivision to help make menus cleaner private void showSongMenu() { boolean running = true; @@ -136,6 +141,94 @@ private void showSongMenu() { } } while (running); } + + //subdivision to help make menus cleaner + private void adjustGigLineupMenu() { + if (bgm.getGigs().isEmpty()) { + System.out.println("No gigs available."); + return; + } + + System.out.println("Select a gig to adjust lineup for:"); + bgm.viewAllGigs(); + + int gigIndex = promptForGigIndex("Enter gig number: "); + if (gigIndex == -1) { + return; + } + + Gig gig = bgm.findGigByIndex(gigIndex); + + if (gig.isCompleted()) { + System.out.println("Cannot adjust lineup for a completed gig."); + return; + } + + boolean editing = true; + + while (editing) { + System.out.println("\n===== LINEUP MENU ====="); + System.out.println("Gig: " + gig.getDate() + " at " + gig.getVenue().getName()); + System.out.println("Current Lineup: " + gig.getLineup()); + System.out.println("1. Apply Default Lineup"); + System.out.println("2. Add Band Member"); + System.out.println("3. Remove Band Member"); + System.out.println("4. Swap Band Member"); + System.out.println("0. Return to Main Menu"); + System.out.print("Select option: "); + + int choice = InputHandler.handleIntegerInput(sc); + + switch (choice) { + case 1: + bgm.applyDefaultLineup(gig); + System.out.println("Default lineup applied to this gig."); + break; + case 2: + System.out.print("Enter member to add: "); + String memberToAdd = InputHandler.handleStringInput(sc); + gig.addBandMember(memberToAdd); + System.out.println("Band member added to this gig."); + break; + case 3: + System.out.print("Enter member to remove: "); + String memberToRemove = InputHandler.handleStringInput(sc); + gig.removeBandMember(memberToRemove); + System.out.println("Band member removed from this gig."); + break; + case 4: + System.out.print("Enter member to replace: "); + String oldMember = InputHandler.handleStringInput(sc); + + System.out.print("Enter new member: "); + String newMember = InputHandler.handleStringInput(sc); + + gig.swapBandMember(oldMember, newMember); + System.out.println("Band member swapped for this gig."); + break; + case 0: + editing = false; + break; + default: + System.out.println("Invalid selection."); + } + } + } +//helper function to get gig being referenced by user + private int promptForGigIndex(String prompt) { + System.out.print(prompt); + int gigNumber = InputHandler.handleIntegerInput(sc); + + Gig gig = bgm.findGigByIndex(gigNumber - 1); + if (gig == null) { + System.out.println("Invalid gig selection."); + return -1; + } + + return gigNumber - 1; + } + +//function to collect user input needed to create a new gig private void addNewGig() { System.out.print("Enter name of gig venue: "); String venueName = InputHandler.handleStringInput(sc); @@ -160,6 +253,7 @@ private void addNewGig() { System.out.println("Gig added successfully."); } + //unused in current implementation, can display info about a venue private void viewVenueInformation() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); @@ -175,6 +269,7 @@ private void viewVenueInformation() { System.out.println(gig.getVenue()); } + //calls helper to figure out which gig is being referenced and marks it as complete private void markGigComplete() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); @@ -195,6 +290,7 @@ private void markGigComplete() { } } + //collects user input for which song to use as an argument for bgm.addSongToCatalog private void addSongToCatalog() { System.out.print("Enter name of song to add to catalog: "); String song = InputHandler.handleStringInput(sc); @@ -202,6 +298,7 @@ private void addSongToCatalog() { System.out.println("Song added to catalog."); } + //loops through each song in bgm and prints them private void viewSongCatalog() { if (bgm.getSongCatalog().isEmpty()) { System.out.println("Song catalog is empty."); @@ -214,6 +311,8 @@ private void viewSongCatalog() { } } + //collects user input on which gig to generate a setlist for, generates setlist using bgm method + // based on user input for set length, as well as songs in catalog private void generateSetlist() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); @@ -248,6 +347,7 @@ private void generateSetlist() { System.out.println("Setlist: " + gig.getSetlist()); } + //takes user input to use for displaying setlist info about a particular gig private void viewGigSetlist() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); @@ -277,6 +377,7 @@ private void viewGigSetlist() { } } + //takes user input to use for displaying info about a particular gig private void viewGigDetails() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); @@ -294,6 +395,7 @@ private void viewGigDetails() { bgm.viewGigDetails(gigIndex); } + //takes user input to use in bgm method to manually add a song to a setlist private void addSongToGigSetlist() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); @@ -320,6 +422,7 @@ private void addSongToGigSetlist() { } } + //takes user input to use in bgm method to manually remove a song from a setlist private void removeSongFromGigSetlist() { if (bgm.getGigs().isEmpty()) { System.out.println("No gigs available."); @@ -357,89 +460,4 @@ private void removeSongFromGigSetlist() { System.out.println("Removed song: " + removedSong); } } - - private void adjustGigLineupMenu() { - if (bgm.getGigs().isEmpty()) { - System.out.println("No gigs available."); - return; - } - - System.out.println("Select a gig to adjust lineup for:"); - bgm.viewAllGigs(); - - int gigIndex = promptForGigIndex("Enter gig number: "); - if (gigIndex == -1) { - return; - } - - Gig gig = bgm.findGigByIndex(gigIndex); - - if (gig.isCompleted()) { - System.out.println("Cannot adjust lineup for a completed gig."); - return; - } - - boolean editing = true; - - while (editing) { - System.out.println("\n===== LINEUP MENU ====="); - System.out.println("Gig: " + gig.getDate() + " at " + gig.getVenue().getName()); - System.out.println("Current Lineup: " + gig.getLineup()); - System.out.println("1. Apply Default Lineup"); - System.out.println("2. Add Band Member"); - System.out.println("3. Remove Band Member"); - System.out.println("4. Swap Band Member"); - System.out.println("0. Return to Main Menu"); - System.out.print("Select option: "); - - int choice = InputHandler.handleIntegerInput(sc); - - switch (choice) { - case 1: - bgm.applyDefaultLineup(gig); - System.out.println("Default lineup applied to this gig."); - break; - case 2: - System.out.print("Enter member to add: "); - String memberToAdd = InputHandler.handleStringInput(sc); - gig.addBandMember(memberToAdd); - System.out.println("Band member added to this gig."); - break; - case 3: - System.out.print("Enter member to remove: "); - String memberToRemove = InputHandler.handleStringInput(sc); - gig.removeBandMember(memberToRemove); - System.out.println("Band member removed from this gig."); - break; - case 4: - System.out.print("Enter member to replace: "); - String oldMember = InputHandler.handleStringInput(sc); - - System.out.print("Enter new member: "); - String newMember = InputHandler.handleStringInput(sc); - - gig.swapBandMember(oldMember, newMember); - System.out.println("Band member swapped for this gig."); - break; - case 0: - editing = false; - break; - default: - System.out.println("Invalid selection."); - } - } - } - - private int promptForGigIndex(String prompt) { - System.out.print(prompt); - int gigNumber = InputHandler.handleIntegerInput(sc); - - Gig gig = bgm.findGigByIndex(gigNumber - 1); - if (gig == null) { - System.out.println("Invalid gig selection."); - return -1; - } - - return gigNumber - 1; - } } \ No newline at end of file From d1d9a0dfd46fec0efa1ca1ed644f5c51b54ed9c7 Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 09:04:20 -0400 Subject: [PATCH 16/21] updated comments --- .../org/codedifferently/BandGigManager.java | 24 +++++++++++++++++++ src/main/java/org/codedifferently/Gig.java | 15 +++++++++++- src/main/java/org/codedifferently/Venue.java | 1 + 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/codedifferently/BandGigManager.java b/src/main/java/org/codedifferently/BandGigManager.java index 0bc7833..d02d2ed 100644 --- a/src/main/java/org/codedifferently/BandGigManager.java +++ b/src/main/java/org/codedifferently/BandGigManager.java @@ -5,6 +5,7 @@ //stores main abstraction of modifier methods we call when we want to update/view/adjust fields in the program public class BandGigManager { + //arraylists used because we need a collection to store objects that is not fixed in size //needed to be able to easily add and remove objects from list, and access them with indexing //for this reason ArrayList was a good choice @@ -12,6 +13,7 @@ public class BandGigManager { private final ArrayList songCatalog; private final ArrayList defaultBandMembers; + //constructor, no paramaters needed public BandGigManager() { gigs = new ArrayList<>(); songCatalog = new ArrayList<>(); @@ -22,14 +24,17 @@ public BandGigManager() { defaultBandMembers.add("Matty"); } + //add gig to ArrayList public void addGig(Gig gig) { gigs.add(gig); } + //getter to return list of gigs public ArrayList getGigs() { return gigs; } + //find gig at index in ArrayList public Gig findGigByIndex(int index) { if (index >= 0 && index < gigs.size()) { return gigs.get(index); @@ -37,6 +42,7 @@ public Gig findGigByIndex(int index) { return null; } + //update gig complete boolean public boolean markGigCompleteByIndex(int index) { Gig gig = findGigByIndex(index); @@ -48,18 +54,21 @@ public boolean markGigCompleteByIndex(int index) { return true; } + //display all gigs in array list public void viewAllGigs() { if (gigs.isEmpty()) { System.out.println("No gigs available."); return; } + //for loops are going to allow us to iterate through the list for (int i = 0; i < gigs.size(); i++) { System.out.println((i + 1) + ". " + gigs.get(i)); System.out.println(); } } + //display all gigs that aren't completed public void viewUpcomingGigs() { boolean found = false; @@ -76,6 +85,7 @@ public void viewUpcomingGigs() { } } + //display all gigs that are completed public void viewCompletedGigs() { boolean found = false; @@ -92,9 +102,11 @@ public void viewCompletedGigs() { } } + //sum payments of the gigs public double calculateTotalEarnings() { double total = 0.0; + //enhanced for loop to iterate through list, only add to sum if gig is completed for (Gig gig : gigs) { if (gig.isCompleted()) { total += gig.getPayment(); @@ -104,33 +116,41 @@ public double calculateTotalEarnings() { return total; } + //add song to catalog list public void addSongToCatalog(String song) { songCatalog.add(song); } + //get entire song catalog list object public ArrayList getSongCatalog() { return songCatalog; } + //not used public void addDefaultBandMember(String member) { defaultBandMembers.add(member); } + //not used, getter public ArrayList getDefaultBandMembers() { return defaultBandMembers; } + //clear lineup and add members in defaultBandMembers to gig lineup public void applyDefaultLineup(Gig gig) { gig.getLineup().clear(); gig.getLineup().addAll(defaultBandMembers); } + public void generateSetlistForGig(Gig gig, int numberOfSongs) { if (songCatalog.isEmpty()) { return; } ArrayList tempSongs = new ArrayList<>(songCatalog); + + //randomly reorder elements in collection tempSongs Collections.shuffle(tempSongs); gig.clearSetlist(); @@ -140,6 +160,7 @@ public void generateSetlistForGig(Gig gig, int numberOfSongs) { } } + //takes gig index to add generated setlist to specific gig public boolean generateSetlistForGigByIndex(int index, int numberOfSongs) { Gig gig = findGigByIndex(index); @@ -151,6 +172,7 @@ public boolean generateSetlistForGigByIndex(int index, int numberOfSongs) { return true; } + //add song to setlist array list, if/else locks out gig if completed public boolean addSongToGigSetlist(int gigIndex, String song) { Gig gig = findGigByIndex(gigIndex); @@ -162,6 +184,7 @@ public boolean addSongToGigSetlist(int gigIndex, String song) { return true; } + //remove song from setlist array list in gig, if/else locks out gig if completed public String removeSongFromGigSetlist(int gigIndex, int songIndex) { Gig gig = findGigByIndex(gigIndex); @@ -172,6 +195,7 @@ public String removeSongFromGigSetlist(int gigIndex, int songIndex) { return gig.removeSongAtIndex(songIndex); } + //display gig info, lineup and setlist for a gig public void viewGigDetails(int index) { Gig gig = findGigByIndex(index); diff --git a/src/main/java/org/codedifferently/Gig.java b/src/main/java/org/codedifferently/Gig.java index 92fed97..de0590e 100644 --- a/src/main/java/org/codedifferently/Gig.java +++ b/src/main/java/org/codedifferently/Gig.java @@ -3,6 +3,8 @@ import java.util.ArrayList; public class Gig { + //used private fields to limit accessibility as much as possible + //fulfilling encapsulation principles private String date; private Venue venue; private double payment; @@ -10,12 +12,14 @@ public class Gig { private ArrayList lineup; private ArrayList setlist; + //constructor no arguments public Gig() { lineup = new ArrayList<>(); setlist = new ArrayList<>(); - completed = false; + completed = false; //completed defaults to false, gig has to be manually logged as complete } + //alternate constructor public Gig(String date, Venue venue, double payment) { this.date = date; this.venue = venue; @@ -25,10 +29,12 @@ public Gig(String date, Venue venue, double payment) { this.setlist = new ArrayList<>(); } + //getter public String getDate() { return date; } + //setter public void setDate(String date) { this.date = date; } @@ -74,10 +80,12 @@ public void setSetlist(ArrayList setlist) { } + //add to arraylist public void addBandMember(String member) { lineup.add(member); } + //remove from arraylist public void removeBandMember(String member) { lineup.remove(member); } @@ -86,14 +94,17 @@ public void addSong(String song) { setlist.add(song); } + //remove all from setlist arraylist public void clearSetlist() { setlist.clear(); } + //update completed boolean to true public void markCompleted() { completed = true; } + //tells us whether completed boolean is true or false public String getStatus() { if (completed) { return "Completed"; @@ -101,6 +112,7 @@ public String getStatus() { return "Scheduled"; } + //update index of lineup arraylist public void swapBandMember(String oldMember, String newMember) { int index = lineup.indexOf(oldMember); @@ -109,6 +121,7 @@ public void swapBandMember(String oldMember, String newMember) { } } + //remove item at index in setlist arraylist public String removeSongAtIndex(int index) { if (index >= 0 && index < setlist.size()) { return setlist.remove(index); diff --git a/src/main/java/org/codedifferently/Venue.java b/src/main/java/org/codedifferently/Venue.java index ecb9d5f..1776f4f 100644 --- a/src/main/java/org/codedifferently/Venue.java +++ b/src/main/java/org/codedifferently/Venue.java @@ -14,6 +14,7 @@ public Venue(String name, String city, int capacity) { this.capacity = capacity; } + //getters and setters public String getName() { return name; } From 669445dce392e0450fbd8280046d545808469ed3 Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 09:26:30 -0400 Subject: [PATCH 17/21] read me update --- src/main/java/org/codedifferently/README.md | 42 ++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/codedifferently/README.md b/src/main/java/org/codedifferently/README.md index 1b411c6..273cfe4 100644 --- a/src/main/java/org/codedifferently/README.md +++ b/src/main/java/org/codedifferently/README.md @@ -26,7 +26,7 @@ We plan to allow users to do the following: - View full gig details, including venue, status, lineup, and setlist -## THE BUILD: +## THE PLAN: - Venue This class will store information about a venue. @@ -73,9 +73,41 @@ Keep the program running until the user exits - Main() Call UI to run program. +## THE BUILD +-Venue +This class does store information about venues, but we simplified it and removed fields +like contact name and contact email. It wasn't helpful for our MVP. + +-Gig +This class successfully stores info about gigs, but we cut down on some of the fields for simplicity. +We were not able to implement gigID or eventName. This is something we can look at implementing in our next iteration, +as we still think these are important identifiers to have. + +-BandGigManager +We managed to essentially accomplish everything we set out to do with this class. We were +also able to incorporate features like band lineup adjustment. One thing that we missed which we could improve, +pertaining to the bandGigManager and Gig is using actual date/times for tracking gigs. We could have +displayed these to the user in chronological order (instead of order of first insertion), but this is +something we could accomplish with more time. + +-UI +Completely implemented, handles all user input and runs main program loop. We ran into issues with menu complexity, +we tried to resolve this by creating submenus with similar options grouped together, rather than one giant menu. + + +We consistently had issues with using nextInt in our scanner, as well as trying to refactor the code +to be robust against bad input. The nextInt thing was a token issue where it would skip our next input, so we just added +an extra nextLine() wherever that appeared. For input handling, we imported helper functions from another project and +incorporated them into our code. + ## THE REFLECTION --Our program is robust and has many capabilities not really necessary given scope of project. We did not need to use Abstraction -since no classes extended parent classes in this program, and no interfaces were needed. Encapsulation is used on Gig, Venue, and BandGigManager -classes with private fields being accessed by getters and setters. +-Our program is a complete MVP, functionally accomplishing everything that we wanted to. The code and structure is pretty +well organized, however we can incorporate more detailed comments. There are also leftover getter/setter methods that were +never actually used in the project, that are still hanging around. These could be removed or given a use in the program. +We used a lot of Encapsulation throughout the project, included in Gig, Venue, and BandGigManager +classes which have private fields being accessed by getters and setters. There was polymorphism used, with multiple overloaded functions. +Abstraction was used in a conceptual sense with class design, but not implemented with abstract classes or interfaces. +Inheritance wasn't directly used, there are no subclasses extending parent classes. -This program reinforced concepts we've previously implemented. \ No newline at end of file +This program reinforced concepts we've previously implemented and really helped with the process of designing software from scratch, +rather than following a pre-scripted scenario. \ No newline at end of file From 30b69d3fb7cfbcc72764086e9a54e1ca19a97a6d Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 13:07:11 -0400 Subject: [PATCH 18/21] adjusted print --- src/main/java/org/codedifferently/UI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/codedifferently/UI.java b/src/main/java/org/codedifferently/UI.java index de1fb9d..bf0b8ce 100644 --- a/src/main/java/org/codedifferently/UI.java +++ b/src/main/java/org/codedifferently/UI.java @@ -15,7 +15,7 @@ public void startProgram() { boolean running = true; while (running) { - System.out.println("\n============= OPENING BAND GIG MANAGER ============="); + System.out.println("\n============= BAND GIG MANAGER ============="); System.out.println("1. Gig Scheduling"); System.out.println("2. Song and Setlist Maintenance"); System.out.println("3. Band Lineup"); From e87dda7d8c335f409be3d6e58c729c45ce964223 Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 13:16:48 -0400 Subject: [PATCH 19/21] adjusted readme --- src/main/java/org/codedifferently/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/codedifferently/README.md b/src/main/java/org/codedifferently/README.md index 273cfe4..126492d 100644 --- a/src/main/java/org/codedifferently/README.md +++ b/src/main/java/org/codedifferently/README.md @@ -60,7 +60,7 @@ display upcoming gigs calculate total earnings store default band members store a song catalog -generate setlists for gigs +generate setlists for gigs (weighted setlists) - UI() This class handles menus and user prompts with Scanner to keep Main method clean. @@ -84,11 +84,12 @@ We were not able to implement gigID or eventName. This is something we can look as we still think these are important identifiers to have. -BandGigManager -We managed to essentially accomplish everything we set out to do with this class. We were +We managed to mostly accomplish everything we set out to do with this class. We were also able to incorporate features like band lineup adjustment. One thing that we missed which we could improve, pertaining to the bandGigManager and Gig is using actual date/times for tracking gigs. We could have displayed these to the user in chronological order (instead of order of first insertion), but this is -something we could accomplish with more time. +something we could accomplish with more time. Additionally, we could've incorporated weighted setlists, which is something +we wanted to try to tackle during planning. -UI Completely implemented, handles all user input and runs main program loop. We ran into issues with menu complexity, From 5eb74ecddff64327a9e03fee8fefb5cef254586c Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 13:19:40 -0400 Subject: [PATCH 20/21] adjusted readme2 --- src/main/java/org/codedifferently/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/codedifferently/README.md b/src/main/java/org/codedifferently/README.md index 126492d..8fc9e5f 100644 --- a/src/main/java/org/codedifferently/README.md +++ b/src/main/java/org/codedifferently/README.md @@ -89,7 +89,7 @@ also able to incorporate features like band lineup adjustment. One thing that we pertaining to the bandGigManager and Gig is using actual date/times for tracking gigs. We could have displayed these to the user in chronological order (instead of order of first insertion), but this is something we could accomplish with more time. Additionally, we could've incorporated weighted setlists, which is something -we wanted to try to tackle during planning. +we wanted to try to tackle during planning. We also might consider using a set for setlist (since it can't contain duplicates). -UI Completely implemented, handles all user input and runs main program loop. We ran into issues with menu complexity, From 7d5f9229157055ba8b5c5b51a937f717482f61f7 Mon Sep 17 00:00:00 2001 From: atrunz Date: Tue, 10 Mar 2026 13:27:44 -0400 Subject: [PATCH 21/21] anothe readme update --- src/main/java/org/codedifferently/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/codedifferently/README.md b/src/main/java/org/codedifferently/README.md index 8fc9e5f..2ae3e35 100644 --- a/src/main/java/org/codedifferently/README.md +++ b/src/main/java/org/codedifferently/README.md @@ -104,7 +104,8 @@ incorporated them into our code. ## THE REFLECTION -Our program is a complete MVP, functionally accomplishing everything that we wanted to. The code and structure is pretty well organized, however we can incorporate more detailed comments. There are also leftover getter/setter methods that were -never actually used in the project, that are still hanging around. These could be removed or given a use in the program. +never actually used in the project, that are still hanging around. These could be removed or given a use in the program. We also +mentioned some additional features we could add in BandGigManager. We used a lot of Encapsulation throughout the project, included in Gig, Venue, and BandGigManager classes which have private fields being accessed by getters and setters. There was polymorphism used, with multiple overloaded functions. Abstraction was used in a conceptual sense with class design, but not implemented with abstract classes or interfaces.