Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5c32e99
boilerplate
atrunz Mar 9, 2026
95ebf7d
new branch
atrunz Mar 9, 2026
7f3409a
UI class created.
wainswo302 Mar 9, 2026
d0060de
Merge pull request #1 from atrunz/FredsBranch
atrunz Mar 9, 2026
3f21485
Merge branch 'main' of https://github.com/atrunz/creative-cli-project…
atrunz Mar 9, 2026
f7ba895
working on UI
wainswo302 Mar 9, 2026
8f0b131
Merge pull request #2 from atrunz/FredsBranch
wainswo302 Mar 9, 2026
a70a48a
update UI
atrunz Mar 9, 2026
07894e2
merge
atrunz Mar 9, 2026
bad8e6c
Merge branch 'main' of https://github.com/atrunz/creative-cli-project…
atrunz Mar 9, 2026
6e2db29
main logic complete
atrunz Mar 9, 2026
7168b8a
Merge pull request #3 from atrunz/alex-branch
atrunz Mar 9, 2026
f6aa6d6
fixing merge conflict
wainswo302 Mar 9, 2026
318d4ec
fixing merge conflict
wainswo302 Mar 9, 2026
7b7b841
additional menu edits
wainswo302 Mar 9, 2026
1125be4
Merge pull request #4 from atrunz/FredsBranch
wainswo302 Mar 9, 2026
fc9aee9
split set/band functionality in UI
atrunz Mar 9, 2026
d0cddd8
Merge pull request #5 from atrunz/alex-branch
atrunz Mar 9, 2026
5a01635
README.md is complete.
wainswo302 Mar 10, 2026
15f5a50
Merge pull request #6 from atrunz/FredsBranch
wainswo302 Mar 10, 2026
714aba5
fixed setlist creation functionality + band lineup functionality in U…
atrunz Mar 10, 2026
5a7c35d
Merge pull request #7 from atrunz/alex-branch
atrunz Mar 10, 2026
7874ad1
added input handling, refactored UI, BandGigManager and Venue to be m…
atrunz Mar 10, 2026
0977aca
Merge pull request #8 from atrunz/alex-branch
atrunz Mar 10, 2026
840e459
fixed default band lineup
atrunz Mar 10, 2026
c392ea7
Merge pull request #9 from atrunz/alex-branch
atrunz Mar 10, 2026
0365afa
added way to view details like set and lineup for a gig
atrunz Mar 10, 2026
09bb1fd
Merge pull request #10 from atrunz/alex-branch
atrunz Mar 10, 2026
cb71e87
started comments
atrunz Mar 10, 2026
826c44f
Merge pull request #11 from atrunz/alex-branch
atrunz Mar 10, 2026
d1d9a0d
updated comments
atrunz Mar 10, 2026
e54f764
Merge pull request #12 from atrunz/alex-branch
atrunz Mar 10, 2026
669445d
read me update
atrunz Mar 10, 2026
71bdc14
Merge pull request #13 from atrunz/alex-branch
atrunz Mar 10, 2026
30b69d3
adjusted print
atrunz Mar 10, 2026
e87dda7
adjusted readme
atrunz Mar 10, 2026
5eb74ec
adjusted readme2
atrunz Mar 10, 2026
7d5f922
anothe readme update
atrunz Mar 10, 2026
93019c9
Merge pull request #14 from atrunz/alex-branch
atrunz Mar 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 211 additions & 0 deletions src/main/java/org/codedifferently/BandGigManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
package org.codedifferently;

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<Gig> gigs;
private final ArrayList<String> songCatalog;
private final ArrayList<String> defaultBandMembers;

//constructor, no paramaters needed
public BandGigManager() {
gigs = new ArrayList<>();
songCatalog = new ArrayList<>();
defaultBandMembers = new ArrayList<>();
defaultBandMembers.add("Alex");
defaultBandMembers.add("Jonny");
defaultBandMembers.add("Bailey");
defaultBandMembers.add("Matty");
}

//add gig to ArrayList
public void addGig(Gig gig) {
gigs.add(gig);
}

//getter to return list of gigs
public ArrayList<Gig> getGigs() {
return gigs;
}

//find gig at index in ArrayList
public Gig findGigByIndex(int index) {
if (index >= 0 && index < gigs.size()) {
return gigs.get(index);
}
return null;
}

//update gig complete boolean
public boolean markGigCompleteByIndex(int index) {
Gig gig = findGigByIndex(index);

if (gig == null) {
return false;
}

gig.markCompleted();
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;

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.");
}
}

//display all gigs that are completed
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.");
}
}

//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();
}
}

return total;
}

//add song to catalog list
public void addSongToCatalog(String song) {
songCatalog.add(song);
}

//get entire song catalog list object
public ArrayList<String> getSongCatalog() {
return songCatalog;
}

//not used
public void addDefaultBandMember(String member) {
defaultBandMembers.add(member);
}

//not used, getter
public ArrayList<String> 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<String> tempSongs = new ArrayList<>(songCatalog);

//randomly reorder elements in collection tempSongs
Collections.shuffle(tempSongs);

gig.clearSetlist();

for (int i = 0; i < numberOfSongs && i < tempSongs.size(); i++) {
gig.addSong(tempSongs.get(i));
}
}

//takes gig index to add generated setlist to specific gig
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;
}

//add song to setlist array list, if/else locks out gig if completed
public boolean addSongToGigSetlist(int gigIndex, String song) {
Gig gig = findGigByIndex(gigIndex);

if (gig == null || gig.isCompleted()) {
return false;
}

gig.addSong(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);

if (gig == null || gig.isCompleted()) {
return null;
}

return gig.removeSongAtIndex(songIndex);
}

//display gig info, lineup and setlist for a gig
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());
}
}
141 changes: 141 additions & 0 deletions src/main/java/org/codedifferently/Gig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
package org.codedifferently;

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;
private boolean completed;
private ArrayList<String> lineup;
private ArrayList<String> setlist;

//constructor no arguments
public Gig() {
lineup = new ArrayList<>();
setlist = new ArrayList<>();
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;
this.payment = payment;
this.completed = false;
this.lineup = new ArrayList<>();
this.setlist = new ArrayList<>();
}

//getter
public String getDate() {
return date;
}

//setter
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<String> getLineup() {
return lineup;
}

public void setLineup(ArrayList<String> lineup) {
this.lineup = lineup;
}

public ArrayList<String> getSetlist() {
return setlist;
}

public void setSetlist(ArrayList<String> setlist) {
this.setlist = setlist;
}


//add to arraylist
public void addBandMember(String member) {
lineup.add(member);
}

//remove from arraylist
public void removeBandMember(String member) {
lineup.remove(member);
}

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";
}
return "Scheduled";
}

//update index of lineup arraylist
public void swapBandMember(String oldMember, String newMember) {
int index = lineup.indexOf(oldMember);

if (index != -1) {
lineup.set(index, newMember);
}
}

//remove item at index in setlist arraylist
public String removeSongAtIndex(int index) {
if (index >= 0 && index < setlist.size()) {
return setlist.remove(index);
}
return null;
}

@Override
public String toString() {
return "Date: " + date +
"\nVenue: " + venue.getName() +
"\nCity: " + venue.getCity() +
"\nPayment: $" + payment +
"\nStatus: " + getStatus();
}
}
//
14 changes: 6 additions & 8 deletions src/main/java/org/codedifferently/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
//TIP Press <shortcut actionId="ShowIntentionActions"/> 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 <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
System.out.println("i = " + i);
//all user input logic stored in UI
UI ui = new UI();
ui.startProgram();



}
}
}
Loading