In: Computer Science
Write a java program to produce an invoice for the lease groups who use the camp Orchard Green.
Orchard Green is a 200 acre camp with access to different activities for lease groups. Lease groups rent the spaces they want to use, have programs (tower, canoeing, team building) run for them to enjoy, and are provided meals. Orchard green has a maximum capacity of 100 people. There are two residence halls (A and B), each with a capacity of 50 people. Each residence hall costs $1600 per night. For those groups that want to have other meeting spaces and areas to enjoy, there is a lodge ($500 per group), meeting room ($800 per group), and gym ($500 per group). The dining hall costs $300 for the group to use, provides breakfast, lunch, and dinner, and each meal costs $8 per person. Groups arrive at 4pm on the first day and leave at 4pm on the last day. Lease groups can have tower sessions where they climb a 50 foot tower ($20 per person), canoeing sessions where they canoe and peddle boat on a lake ($200 per group), and team building sessions where groups learn the value of teamwork ($200 per group). Orchard Green will provide 4 staff members to run the activities at $200 per staff member for the group. The lease group will also need a host from Orchard Green who will provide a variety of support during their stay ($40 per day).
The program will ask for the number of participants and the number of nights staying at the camp.
Input
90, 3
The prompts
Number of participants:
Number of nights staying at the camp:
Notes:
Document your program.
Example of Invoice:
ORCHARD GREEN INVOICE Idaho Bluegills Basketball Association |
|
Number of Participants |
90 |
Number of Nights |
3 |
Number of Days |
|
Residence Hall A |
|
Residence Hall B |
|
Lodge (per group rate) |
$500.00 |
Meeting room (per group rate) |
$800.00 |
Gym (per group rate) |
$500.00 |
Dining Hall (per group rate) |
$300.00 |
Meals |
|
Tower Session |
|
Canoeing Session |
$200.00 |
Team Building Session |
$200.00 |
Cost of Staff |
|
Cost of Host |
|
Subtotal |
|
Tax (6% on non-meal items) |
|
Grand Total |
Screenshot
---------------------------------------
Program
//Package for input read
import java.util.Scanner;
public class OrchardGreenInvoiceGenerator {
//Constants
public static final double LODGE=500.00;
public static final double MEETINGROOM=800.00;
public static final double DININGHALL=300.00;
public static final double GYM=500.00;
public static final double
CANOEINGSESSION=200.00;
public static final double
TEAMBUILDINGSESSION=200.00;
public static final double MEALSCOST=8.00;
public static final double CLIMBCOST=20.00;
public static final double STAFFCHARGE=200.00;
public static final double HOSTCHARGE=40.00;
//Calculation variables
public static double
subTotal=(LODGE+MEETINGROOM+DININGHALL+GYM+CANOEINGSESSION+TEAMBUILDINGSESSION);
public static double taxUnder=subTotal;
//Display formatting
public static String leftAlignFormat = "|
%-25s | $%-17.2f |%n";
public static String leftAlignFormat2 = "|
%-25s | %-15d |%n";
//Method to find number days stay
public static int numDays(int numNights) {
return numNights;
}
//Calculate hall usage and count
public static void residentsHallCalculation(int
participantCount) {
if(participantCount<50) {
System.out.format(leftAlignFormat2, "Residence Hall
A",participantCount);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat2, "Residence Hall B",0);
System.out.format("+-------------------------------+--------------------+%n");
}
else {
System.out.format(leftAlignFormat2, "Residence Hall A",50);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat2, "Residence Hall
B",(participantCount-50));
System.out.format("+-------------------------------+--------------------+%n");
}
}
//Method to get meal charge
public static double mealsCharge(int numDays,int
participantCount) {
subTotal+=numDays*3*MEALSCOST*participantCount;
return
numDays*3*MEALSCOST*participantCount;
}
//Method to get climb charge
public static double climbCharge(int participantCount)
{
subTotal+=CLIMBCOST*participantCount;
taxUnder+=CLIMBCOST*participantCount;
return
CLIMBCOST*participantCount;
}
//Method to generate staff charge
public static double staffCharge() {
subTotal+=4*STAFFCHARGE;
taxUnder+=4*STAFFCHARGE;
return 4*STAFFCHARGE;
}
//Method to get host charge
public static double hostCharge(int numDays) {
subTotal+=HOSTCHARGE*numDays;
taxUnder+=HOSTCHARGE*numDays;
return HOSTCHARGE*numDays;
}
//Method to generate Invoice
public static void invoiceGenerator(int
participantCount,int numNights) {
System.out.format("+----------------------------------------------------+%n");
System.out.format("| ORCHARD GREEN
INVOICE
|%n");
System.out.format("| Idaho
Bluegills Basketball
Association
|%n");
System.out.format("+----------------------------------------------------+%n");
//System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat2,
"Number of Participants",participantCount);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat2,
"Number of Nights",numNights);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat2,
"Number of Days",numDays(numNights));
System.out.format("+-------------------------------+--------------------+%n");
System.out.println("|
|");
System.out.format("+-------------------------------+--------------------+%n");
residentsHallCalculation(participantCount);
System.out.format(leftAlignFormat,
"Lodge (per group rate)",LODGE);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"MeetingRoom(pergrouprate)",MEETINGROOM);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"Gym (per group rate)",GYM);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"DiningHall(pergrouprate)",DININGHALL);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"MEALS",mealsCharge(numNights,participantCount));
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"Tower Session",climbCharge(participantCount));
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"Canoeing Session",CANOEINGSESSION);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"Team Building Session",TEAMBUILDINGSESSION);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"Cost of Staff",staffCharge());
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"Cost of Host",hostCharge(numNights));
System.out.format("+-------------------------------+--------------------+%n");
System.out.println("|
|");
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"Subtotal",subTotal);
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"Tax(6%non-meal items)",(taxUnder*.06));
System.out.format("+-------------------------------+--------------------+%n");
System.out.println("|
|");
System.out.format("+-------------------------------+--------------------+%n");
System.out.format(leftAlignFormat,
"Grand Total",(subTotal+(taxUnder*.06)));
System.out.format("+-------------------------------+--------------------+%n");
}
//Test
public static void main(String[] args) {
//Scanner object for input
read
Scanner sc=new
Scanner(System.in);
//Read participant count
System.out.print("Number of
participants: ");
int
participantCount=sc.nextInt();
while(participantCount<1 ||
participantCount>100 ) {
System.out.println("Participant count should be positive and maximu
is 100!!!! Please Re-enter.");
System.out.print("Number of participants: ");
participantCount=sc.nextInt();
}
//Read night stay count
System.out.print("Number of nights staying at
the camp: ");
int nights=sc.nextInt();
while(participantCount<0) {
System.out.println("Night
count should not be negative!!!! Please Re-enter.");
System.out.print("Number of
nights staying at the camp: ");
nights=sc.nextInt();
}
//Call method to get invoice
invoiceGenerator(participantCount,nights);
}
}
----------------------------------------------------------------------------
Output
Number of participants: 90
Number of nights staying at the camp: 3
+----------------------------------------------------+
| ORCHARD GREEN
INVOICE
|
| Idaho Bluegills Basketball Association |
+----------------------------------------------------+
| Number of Participants |
90
|
+-------------------------------+--------------------+
| Number of
Nights |
3
|
+-------------------------------+--------------------+
| Number of
Days
|
3
|
+-------------------------------+--------------------+
|
|
+-------------------------------+--------------------+
| Residence Hall
A |
50
|
+-------------------------------+--------------------+
| Residence Hall
B |
40
|
+-------------------------------+--------------------+
| Lodge (per group rate) |
$500.00
|
+-------------------------------+--------------------+
| MeetingRoom(pergrouprate)| $800.00 |
+-------------------------------+--------------------+
| Gym (per group rate) |
$500.00
|
+-------------------------------+--------------------+
| DiningHall(pergrouprate)|
$300.00
|
+-------------------------------+--------------------+
|
MEALS
| $6480.00 |
+-------------------------------+--------------------+
| Tower
Session
| $1800.00 |
+-------------------------------+--------------------+
| Canoeing Session
| $200.00 |
+-------------------------------+--------------------+
| Team Building Session |
$200.00
|
+-------------------------------+--------------------+
| Cost of
Staff
|
$800.00
|
+-------------------------------+--------------------+
| Cost of
Host
|
$120.00
|
+-------------------------------+--------------------+
|
|
+-------------------------------+--------------------+
|
Subtotal
| $11700.00 |
+-------------------------------+--------------------+
| Tax(6%non-meal items) |
$313.20
|
+-------------------------------+--------------------+
|
|
+-------------------------------+--------------------+
| Grand
Total
| $12013.20 |
+-------------------------------+--------------------+