Question

In Java Burdell and the Buzz Problem Description As an aspiring band manager, you need to...

In Java

Burdell and the Buzz

Problem Description

As an aspiring band manager, you need to promote your band and expand publicity. Being hip with the times, you know that social media can make or break a band’s popularity. So, you decide to bring some ‘lucky’ Georgia Tech students to spread the good word!

Solution Description

Write the Concert, Musician, and Fan classes to guide your band on their rock star journey. You will design these classes from scratch following the instructions below, so no files are provided. Note: When creating the specified getter and setter methods for each class, use the naming convention taught in class, e.g. getTicketPrice() and setDate().

Concert.java

Fields

This class has the following private fields, and associated getter methods:

• double ticketPrice. General Admission ticket price.

• int capacity. Venue capacity.

• int ticketsSold. Number of tickets sold.

• String location. Location of the concert.

• String date. The date of the concert in the format MM/DD/YYYY. For example, “02/14/2019”.
Constructor

This class has the following constructors:

• There are two constructors (hint: use constructor chaining)

• The first constructor takes the following four arguments and assigns them to instance variables in the order listed:

– Ticket price

– Capacity

– Location

– Date

– Do not include ticketsSold as a parameter; rather, set its field to 0 within the constructor.

• The second constructor takes the following three arguments and assigns them to instance variables in the order listed:

– Capacity

– Location

– Date

– Do not include ticketsSold as a parameter; rather, set its field to 0 within the constructor. Additionally, do not include ticketPrice as a parameter; rather, set its field to 30 within the constructor.

Methods

This class has the following public methods:

• boolean isSoldOut(). Using the capacity and ticketsSold fields, return whether or not this concert is sold out.

• void sellTicket(). Increment the counter for the number of tickets that have been sold. If the concert is already sold out, you should not change the number of tickets that have been sold.


• String toString(). Returns a String in this format:

A concert on <date> at <location>

• Setters for both location and ticketPrice.

Musician.java

Fields

This class has the following private fields, and associated getter methods:

• String name. Name of the musician.

• String instrument. Name of the musician’s weapon of choice.

• int yearsPlaying. Number of years the musician has been playing the instrument.

• double skillLevel. Related to yearsPlaying, more to explain shortly.

Constructor

This class has the following constructors:

• There are two constructors (hint: use constructor chaining)

• The first constructor takes the following three arguments and assigns them to instance variables in the order listed:

– Name

– Instrument

– Years Playing

• The other constructor takes two parameters in the order listed and sets 0 as the value for yearsPlaying:

– Name

– Instrument

• The skillLevel instance variable is determined inside the constructors by the value for yearsPlaying. At 0 years played, skillLevel is 1.0. Add 0.5 to skillLevel for every additional year played.

Methods

This class has the following public methods:

• void rehearse().

– Increases skillLevel by 0.5 and yearsPlaying by 1 when called.

• void perform().

– Increases skillLevel by 1 when called.

• String toString().

   – Returns a string that prints out the musician’s name, what instrument they play, and how long they’ve been playing for. (No need to worry about “year” vs. “years” here)

– For example:

My name is Taylor Swift. I have been playing guitar for 10 years.

Fan.java Fields

This class has the following private fields, and associated getter methods:

• int yearsAsFan. How many years this person has been a fan of the band.

• int albumsBought. Number of albums that this fan has bought.

• int concertsAttended. Number of concerts this fan has attended.

• boolean buzzcard. Boolean representing whether or not this fan has their Buzzcard.

• Musician favoriteMusician. This fan’s favorite musician.

Constructor

This class has the following constructor:

• The first constructor takes the following five arguments and assigns them to instance variables in the order listed:

– Number of years as a fan

– Number of albums bought

– Number of concerts attended

– Whether or not they have a Buzzcard

– Their favorite musician

Methods

This class has the following public methods:

• boolean winGiveaway().

   – This method returns whether or not the fan wins the ‘giveaway’. However, since we want fans to attend, this will always return true! (Even though they win, they still need to pay for a ticket–your band needs the revenue..)

• String liveTweet(Concert concert). Livetweeting signifies that the Fan has attended a concert. This method will return a String based on the passion level of the fan. Specifically, if the corresponding conditional is true, add to the tweet each time on a new line and in the order presented:

– If the fan has been following the band for over 5 years, the tweet will include: “Best band ever!”

– If the fan paid more than $100 for a ticket, the tweet will include: “Totally worth my entire bank account!”

   ∗ (Hint: you created a getter method for ticket price within the Concert class, and you passed in a Concert parameter to this method)

– If the fan has bought at least one album, the tweet will include: “Even better in person!”

– At the end of every live tweet, it will always include: “I’ve been to <numberofconcerts> concerts!” The fan assumes that this concert does count towards the total number of concerts they have attended in this statement. Update any necessary variables accordingly.

∗ Use a ternary statement to indicate the word “concert” if this is the fan’s first concert, and the word “concerts” otherwise. Proper grammar is essential for any successful manager.

– For example, if we have a Fan named Joe Schmo who has been a fan for 10 years, paid $200 for a ticket, bought 5 albums, and has been to 4 concerts (including this one), the tweet should read:

Best band ever!

Totally worth my entire bank account!

Even better in person!

I’ve been to 4 concerts!

• void lostBuzzcard(). Every Georgia Tech student needs to keep careful track of their Buzzcard! But, sometimes we get a little reckless.

– If the fan has been following the ban for over 3 years, set the boolean buzzcard to false.

• void announceFavoriteMusician(). This method should print:

My favorite musician is <name of Musician>!

ConcertSimulator.java

This class is purely an example of what an output could look like. Its purpose is for you to test your code to produce the correct provided output. You do not have to submit this file. - Create 2 Musicians Christopher W. Klaus has been playing violin for 30 years - UGA has been playing students for 234 years Create 1 Fan - Gerald Clough - 14 years as a fan, 8 albums bought, 52 concerts attended, has his Buzzcard, and his favorite musician is Christopher W. Klaus - Announce Gerald Clough’s favorite Musician - Create 1 Concert - Ticket price is $500 - Venue capacity is 60 seats - Location is Mercedes-Benz Stadium - Date is 02/03/2019 - Sell 60 tickets then see whether or not the concert is booked - If it is, print “Sorry! [details of concert] is fully booked!” - Is there a way to print the details of the concert without hardcoding? - Print out Gerald Clough livetweeting (Note: This increases his total number of concerts attended by one) - The sample output is as follows:

My name is Christopher W. Klaus. I have been playing violin for 30 years.

My name is UGA. I have been playing students for 234 years.

My favorite musician is Christopher W. Klaus! Sorry!

A concert on 02/03/2019 at Mercedes-Benz Stadium is fully booked!

Best band ever!

Totally worth my entire bank account!

Even better in person!

I’ve been to 53 concerts!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

############# Concert.java #############
/**
* The Class Concert.
*/
public class Concert {

   /** The ticket price. */
   private double ticketPrice;

   /** The capacity. */
   private int capacity;

   /** The ticket sold. */
   private int ticketSold;

   /** The location. */
   private String location;

   /** The date. */
   private String date;

   /**
   * Instantiates a new concert.
   *
   * @param ticketPrice the ticket price
   * @param capacity the capacity
   * @param location the location
   * @param date the date
   */
   public Concert(double ticketPrice, int capacity, String location, String date) {
       this(capacity, location, date);
       this.ticketPrice = ticketPrice;
   }

   /**
   * Instantiates a new concert.
   *
   * @param capacity the capacity
   * @param location the location
   * @param date the date
   */
   public Concert(int capacity, String location, String date) {
       this.capacity = capacity;
       this.location = location;
       this.date = date;
       this.ticketSold = 0;
       this.ticketPrice = 30.0;
   }

   /**
   * Checks if is sold out.
   *
   * @return true, if is sold out
   */
   public boolean isSoldOut() {
       if (capacity == ticketSold) {
           return true;
       }
       return false;
   }

   /**
   * Sell ticket.
   */
   public void sellTicket() {
       if (!isSoldOut()) {
           ticketSold++;
       }
   }

   @Override
   public String toString() {
       return String.format("A concert on %s at %s", date, location);
   }

   /**
   * Sets the ticket price.
   *
   * @param ticketPrice the new ticket price
   */
   public void setTicketPrice(double ticketPrice) {
       this.ticketPrice = ticketPrice;
   }

   /**
   * Sets the location.
   *
   * @param location the new location
   */
   public void setLocation(String location) {
       this.location = location;
   }

   /**
   * Gets the ticket price.
   *
   * @return the ticket price
   */
   public double getTicketPrice() {
       return ticketPrice;
   }

   /**
   * Gets the capacity.
   *
   * @return the capacity
   */
   public int getCapacity() {
       return capacity;
   }

   /**
   * Gets the ticket sold.
   *
   * @return the ticket sold
   */
   public int getTicketSold() {
       return ticketSold;
   }

   /**
   * Gets the location.
   *
   * @return the location
   */
   public String getLocation() {
       return location;
   }

   /**
   * Gets the date.
   *
   * @return the date
   */
   public String getDate() {
       return date;
   }

}
############### Musician.java ############

/**
* The Class Musician.
*/
public class Musician {

   /** The name. */
   private String name;

   /** The instrument. */
   private String instrument;

   /** The years playing. */
   private int yearsPlaying;

   /** The skill level. */
   private double skillLevel;

   /**
   * Instantiates a new musician.
   *
   * @param name the name
   * @param instrument the instrument
   */
   public Musician(String name, String instrument) {
       this.name = name;
       this.instrument = instrument;
       this.yearsPlaying = 0;
       this.skillLevel = 1.0;
   }

   /**
   * Instantiates a new musician.
   *
   * @param name the name
   * @param instrument the instrument
   * @param yearsPlaying the years playing
   */
   public Musician(String name, String instrument, int yearsPlaying) {
       this(name, instrument);
       this.yearsPlaying = yearsPlaying;
       this.skillLevel = this.skillLevel + (yearsPlaying * 0.5);
   }

   /**
   * Rehearse.
   */
   public void rehearse() {
       this.skillLevel += 0.5;
       this.yearsPlaying += 1;
   }

   /**
   * Perform.
   */
   public void perform() {
       this.skillLevel += 1;
   }

   @Override
   public String toString() {
       return String.format("My name is %s. I have been playing %s for %d years.", name, instrument, yearsPlaying);
   }

   /**
   * Gets the name.
   *
   * @return the name
   */
   public String getName() {
       return name;
   }

   /**
   * Gets the instrument.
   *
   * @return the instrument
   */
   public String getInstrument() {
       return instrument;
   }

   /**
   * Gets the years playing.
   *
   * @return the years playing
   */
   public int getYearsPlaying() {
       return yearsPlaying;
   }

   /**
   * Gets the skill level.
   *
   * @return the skill level
   */
   public double getSkillLevel() {
       return skillLevel;
   }

}

############### Fan.java ############

/**
* The Class Fan.
*/
public class Fan {

   /** The years as fan. */
   private int yearsAsFan;

   /** The albums bought. */
   private int albumsBought;

   /** The concerts attended. */
   private int concertsAttended;

   /** The buzzcard. */
   private boolean buzzcard;

   /** The favorite musician. */
   private Musician favoriteMusician;

   /**
   * Instantiates a new fan.
   *
   * @param yearsAsFan the years as fan
   * @param albumsBought the albums bought
   * @param concertsAttended the concerts attended
   * @param buzzcard the buzzcard
   * @param favoriteMusician the favorite musician
   */
   public Fan(int yearsAsFan, int albumsBought, int concertsAttended, boolean buzzcard, Musician favoriteMusician) {
       this.yearsAsFan = yearsAsFan;
       this.albumsBought = albumsBought;
       this.concertsAttended = concertsAttended;
       this.buzzcard = buzzcard;
       this.favoriteMusician = favoriteMusician;
   }

   /**
   * Win giveaway.
   *
   * @return true, if successful
   */
   public boolean winGiveaway() {
       return true;

   }

   /**
   * Live tweet.
   *
   * @param concert the concert
   * @return the string
   */
   public String liveTweet(Concert concert) {
       concertsAttended++;
       String tweet = "";
       if (yearsAsFan >= 5) {
           tweet = "Best band ever! ";
       }
       if (concert.getTicketPrice() > 100) {
           tweet = tweet + "Totally worth my entire bank account! ";
       }
       if (albumsBought >= 1) {
           tweet = tweet + "Even better in person! ";
       }
       tweet = tweet + "I’ve been to " + concertsAttended + " concerts!";
       return concertsAttended == 1 ? "Concert" : tweet;

   }

   /**
   * Lost buzzcard.
   */
   public void lostBuzzcard() {
       if (yearsAsFan > 3) {
           this.buzzcard = false;
       }
   }

   /**
   * Announce favorite musician.
   */
   public void announceFavoriteMusician() {
       System.out.println("My favorite musician is " + this.favoriteMusician.getName() + "!");
   }
}

################### ConcertSimulator.java ##############

/**
* The Class ConcertSimulator.
*/
public class ConcertSimulator {

   /**
   * The main method.
   *
   * @param args the arguments
   */
   public static void main(String[] args) {
       Musician musician1 = new Musician("Christopher W. Klaus", "violin", 30);
       Musician musician2 = new Musician("UGA", "students", 234);
       System.out.println(musician1.toString());
       System.out.println(musician2.toString());
       Fan fan = new Fan(14, 8, 52, true, musician1);
       fan.announceFavoriteMusician();
       Concert concert = new Concert(500, 60, "Mercedes-Benz Stadium", "02/03/2019");
       for (int i = 1; i <= 60; i++) {
           concert.sellTicket();
       }
       if (concert.isSoldOut()) {
           System.out.println("Sorry! " + concert.toString() + " is fully booked!");
       }
       System.out.println(fan.liveTweet(concert));
   }
}

############ Output ###############

ConcertSimulator [Java Application] CProgram Files Java yre1.8.0.151in javaw.exe (Feb 11, 2019, 4:24:28 PM) My name is Christopher W. Klaus. I have been playing violin for 30 years My name is UGA. I have been playing students for 234 years. My favorite musician is Christopher W. Klaus! Sorry! A concert on 02/03/2019 at Mercedes-Benz Stadium is fully booked! Best band ever! Totally worth my entire bank account! Even better in person! I've been to 53 concerts!

Add a comment
Know the answer?
Add Answer to:
In Java Burdell and the Buzz Problem Description As an aspiring band manager, you need to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Amusement Park Programming Project Project Outcomes Use the Java selection constructs (if and if else). Use...

    Amusement Park Programming Project Project Outcomes Use the Java selection constructs (if and if else). Use the Java iteration constructs (while, do, for). Use Boolean variables and expressions to control iterations. Use arrays or ArrayList for storing objects. Proper design techniques. Project Requirements Your job is to implement a simple amusement park information system that keeps track of admission tickets and merchandise in the gift shop. The information system consists of three classes including a class to model tickets, a...

  • what is the solution for this Java problem? Generics Suppose you need to process the following...

    what is the solution for this Java problem? Generics Suppose you need to process the following information regarding Students and Courses: A Student has a name, age, ID, and courseList. The class should have a constructor with inputs for setting name, ID and age. The class should have setters and getters for attributes name, ID and age, and a method addCourse, removeCourse, printSchedule. courseList: use the generic class ArrayList<E> as the type of this attribute addCourse: this method takes as...

  • This is assignment and code from this site but it will not compile....can you help? home...

    This is assignment and code from this site but it will not compile....can you help? home / study / engineering / computer science / computer science questions and answers / c++ this assignment requires several classes which interact with each other. two class aggregations ... Question: C++ This assignment requires several classes which interact with each other. Two class aggregatio... (1 bookmark) C++ This assignment requires several classes which interact with each other. Two class aggregations are formed. The program...

  • To be written in JAVA We want you to write a Java class named Character WithStatus...

    To be written in JAVA We want you to write a Java class named Character WithStatus that can be used to keep track of random game effects status on a role playing game character. The following requirements specify what fields you are expected to implement in your class: - A String data field named name to store the character's name - An int data field named health to store the character's health point; at zero they are dead. - An...

  • Hello, In need of help with this Java pa homework. Thank you! 2. Create a normal...

    Hello, In need of help with this Java pa homework. Thank you! 2. Create a normal (POJo, JavaBean) class to represent, i. e. model, varieties of green beans (also known as string beans or snap beans). Following the steps shown in "Assignment: Tutorial on Creating Classes in IntelliJ", create the class in a file of its own in the same package as class Main. Name the class an appropriate name. The class must have (a) private field variables of appropriate...

  • DESCRIPTION You have to design an e-commerce shopping cart. These require classes Item, Electronics, Food, Dress,...

    DESCRIPTION You have to design an e-commerce shopping cart. These require classes Item, Electronics, Food, Dress, Cart and Main. ITEM CLASS Your Item class should contain: Attributes (protected) String name - name of the Item double price - price of the item Methods (public) void setName(String n) - sets the name of Item void setPrice(double p) - sets the price of Item String getName() - retrieves name double getPrice() - retrieves price String formattedOutput() returns a string containing detail of...

  • Draw the UML DIAGRAM ALSO PLEASE DRAW THE UML DIAGRAM.ALSO in java should use the program in java For this task you will create a Point3D class to represent a point that has coordinates in thr...

    Draw the UML DIAGRAM ALSO PLEASE DRAW THE UML DIAGRAM.ALSO in java should use the program in java For this task you will create a Point3D class to represent a point that has coordinates in three dimensions labeled x, y and z. You will then use the class to perform some calculations on an array of these points. You need to draw a UML diagram for the class (Point3D) and then implement the class The Point3D class will have the...

  • Language is Java, any help is appreciated. Thank you! WHERE TO START FROM: import java.util.ArrayList; //PartTest.java...

    Language is Java, any help is appreciated. Thank you! WHERE TO START FROM: import java.util.ArrayList; //PartTest.java //package simple; public class PartTest { public static void main(String[] args) { ArrayList<ExpendablePart> system=new ArrayList<ExpendablePart>();   // creating Part Object Part part1 = new ExpendablePart("Last, First"); part1.setNumber("AX-34R"); part1.setNcage("MN34R"); part1.setNiin("ABCD-RF-WDE-KLJM"); // printing information System.out.println(part1.toString());       //Create a part2 object of class Part Part part2=new ConsumablePart("Widget, purple"); part2.setNumber("12345"); part2.setNcage("OU812"); part2.setNiin("1234-12-123-1234");    // printing information System.out.println(part2.toString());    //checking equality of two Part class objects if(part1.equals(part2)) System.out.println("part1 and...

  • In Java please! Problem You will be using the point class discussed in class to create...

    In Java please! Problem You will be using the point class discussed in class to create a Rectangle class. You also need to have a driver class that tests your rectangle. Requirements You must implement the 3 classes in the class diagram below and use the same naming and data types. Following is a description of what each method does. Point Rectangle RectangleDriver - x: int - top Left: Point + main(args: String[) - y: int - width: int +...

  • code in java please:) Part I Various public transporation can be described as follows: A PublicTransportation...

    code in java please:) Part I Various public transporation can be described as follows: A PublicTransportation class with the following: ticket price (double type) and mumber of stops (int type). A CityBus is a PublicTransportation that in addition has the following: an route number (long type), an begin operation year (int type), a line name (String type), and driver(smame (String type) -A Tram is a CityBus that in addition has the following: maximum speed (int type), which indicates the maximum...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT