Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You'll have to use this code import java.text.NumberFormat; public class PartyTest { public static void main(String[] args) { NumberFormat f = NumberFormat.getCurrencyInstance(); PartyVenue ballroom =

image text in transcribed
image text in transcribed
You'll have to use this code
import java.text.NumberFormat;
public class PartyTest
{
public static void main(String[] args)
{
NumberFormat f = NumberFormat.getCurrencyInstance();
PartyVenue ballroom = new PartyVenue("Hotel Ballroom", 125.50);
PartyVenue church = new PartyVenue("Church Basement", 10.00);
PartyVenue hall = new PartyVenue("Community Hall", 65.00);
Party bobsRetirement = new Party("Nov 5, 2010","6 pm", 3, hall, 20);
Party andrewsBookLaunch=new Party("Sept 16, 2011","7 pm", 4, ballroom, 250);
ChildBirthdayParty chelseasParty = new ChildBirthdayParty("Dec 18, 2010",
"2 pm",
2,
church,
9,
"Chelsea",
8,
"Princess Tea Party");
ChildBirthdayParty tommiesParty = new ChildBirthdayParty("Nov 30, 2010",
"8 pm",
3,
hall,
18,
"Tommy",
14,
"Guitar Hero Mania");
// Test venue methods...
System.out.println("Current Venue Status:");
System.out.println("=====================");
System.out.println(ballroom.getLocation()
+ ": Hourly Rate: "
+ f.format(ballroom.getHourlyRate()));
System.out.println(church.getLocation()
+ ": Hourly Rate: "
+ f.format(church.getHourlyRate()));
System.out.println(hall.getLocation()
+ ": Hourly Rate: "
+ f.format(hall.getHourlyRate()));
hall.setHourlyRate(75.00);
System.out.println(" After changing the rate:");
System.out.println("========================");
System.out.println(hall.getLocation()
+ ": Hourly Rate: "
+ f.format(hall.getHourlyRate()));
System.out.println(" Current Party Status:");
System.out.println("=====================");
System.out.println("Bob's Retirement:");
System.out.println(bobsRetirement.getDate());
System.out.println(bobsRetirement.getTime());
System.out.println(bobsRetirement.getLength() + " hours long");
System.out.println(bobsRetirement.getVenue().getLocation());
System.out.println(bobsRetirement.getNumAttending() + " attendees");
System.out.println("Cost: " + f.format(bobsRetirement.getTotalCost()));
System.out.println(" ...and after adding 10 more guests:");
bobsRetirement.setNumAttending(bobsRetirement.getNumAttending() + 10);
System.out.println("Cost: " + f.format(bobsRetirement.getTotalCost()));
System.out.println(" Current Birthday Party Status:");
System.out.println("==============================");
System.out.println("Birthday party for: "
+ chelseasParty.getGuestOfHonour());
System.out.println(chelseasParty.getDate());
System.out.println(chelseasParty.getTime());
System.out.println(chelseasParty.getLength() + " hours long");
System.out.println(chelseasParty.getVenue().getLocation());
System.out.println(chelseasParty.getNumAttending() + " attendees");
System.out.println(chelseasParty.getAge() + " years old");
System.out.println("Theme: " + chelseasParty.getTheme());
System.out.println("Cost: " + f.format(chelseasParty.getTotalCost()));
System.out.println(" ...and after 2 guests were unable to attend:");
chelseasParty.setNumAttending(chelseasParty.getNumAttending() - 2);
System.out.println("Cost: " + f.format(chelseasParty.getTotalCost()));
} // end main method
} // end PartyTest class
Party Planning A friend of yours has just opened her own party-planning company. She has asked you to write software to help manage her new business. You have decided to begin by writing three classes, named: - PartyVenue - Party, and - ChildBirthdayParty. A PartyVenue represents a location where a party might be held. For each party venue, we need to record: 1. a textual description of the location (e.g. "Queen Anne Hotel Main Ballroom"); and 2. the rental rate per hour (e.g. 125.50) Accessor methods should be provided to retrieve this information when required. Also, your class should provide support for changing the rental rate. Each Party must have: 1. a date (stored as a String, for example "20/12/2009"); 2. a start time (stored as a String, for example 7:00 p.m."): 3. an estimated duration in hours (e.g. 5); 4. a PartyVenue; and 5. the number of guests who have been invited. In addition to the venue rental fee, the party-planning company also charges additional fees (to cover the cost of food, decorations, and the planner's fime). The party-planning company's rates are as follows: For each party, we need appropriate methods to be able to retrieve the following: - date; - start time; - duration; - venue description; - number of guests; - the total venue rental fee (for the full duration of the party); and - the total cost of the party, which includes both the venue rental fee and the partyplanning company's fees. Your friend has noted that her company handles children's birthday parties a bit differently than other parties. She says that all of the information stored in the Party class is still important. However, for a ChildBirthdayParty she must also record: 1. the name of the guest of honour (e.g. "Bobby Smith"); 2. the child's age (e.g. 6); and 3. a theme (e.g. "Cowboy" or "Under the Sea")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions