Question

In: Computer Science

Write a java program to produce an invoice for the lease groups who use the camp...

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

Solutions

Expert Solution

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        |
+-------------------------------+--------------------+


Related Solutions

Java program Statement: Provide a user interface to the invoice program in Section 12.3 that allows...
Java program Statement: Provide a user interface to the invoice program in Section 12.3 that allows a user to enter and print an arbitrary invoice. Do not modify any of the existing classes. ..... ..... ..... /** Describes an invoice for a set of purchased products. */ public class Invoice { /** Adds a charge for a product to this invoice. @param aProduct the product that the customer ordered @param quantity the quantity of the product */ public void add(Product...
Java Program Use for loop 1.) Write a program to display the multiplication table of a...
Java Program Use for loop 1.) Write a program to display the multiplication table of a given integer. Multiplier and number of terms (multiplicand) must be user's input. Sample output: Enter the Multiplier: 5 Enter the number of terms: 3 5x0=0 5x1=5 5x2=10 5x3=15 2 Create a program that will allow the user to input an integer and display the sum of squares from 1 to n. Example, the sum of squares for 10 is as follows: (do not use...
*Java program* Use while loop 1.) Write a program that reads an integer, and then prints...
*Java program* Use while loop 1.) Write a program that reads an integer, and then prints the sum of the even and odd integers. 2.) Write program to calculate the sum of the following series where in is input by user. (1/1 + 1/2 + 1/3 +..... 1/n)
This is for Java programming. Please use ( else if,) when writing the program) Write a...
This is for Java programming. Please use ( else if,) when writing the program) Write a java program to calculate the circumference for the triangle and the square shapes: The circumference for: Triangle = Side1 + Side2 +Sid3 Square = 4 X Side When the program executes, the user is to be presented with 2 choices. Choice 1 to calculate the circumference for the triangle Choice 2 to calculate the circumference for the square Based on the user's selection the...
Write a JAVA program that prompts the user to enter a single name. Use a for...
Write a JAVA program that prompts the user to enter a single name. Use a for loop to determine if the name entered by the user contains at least 1 uppercase and 3 lowercase letters. If the name meets this policy, output that the name has been accepted. Otherwise, output that the name is invalid.
Use Java (Find the number of days in a month) Write a program that prompts the...
Use Java (Find the number of days in a month) Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, If the user entered month 2 and year 2012, the program should display that February 2012 has 29 days. If the user entered month 3 and year 2015, the program should display that March 2015 has 31 days. Sample Run 1 Enter a month in the...
CIT 149 JAVA 1 program question? Write a program that will use static methods as described...
CIT 149 JAVA 1 program question? Write a program that will use static methods as described in the specifications below. Utilizing the if and else statements, write a program which will calculate a commission based on a two-tiered commission plan of 3% and 7% paid on amounts of $15,000 or less, or over $15,000 in monthly sales by a sales force paid on a commission basis. Use the output specifications below. ? Specifications There will be two classes (separate files)...
Create a new Java program named AllAboutMe (For JAVA we use blue J) Write code to...
Create a new Java program named AllAboutMe (For JAVA we use blue J) Write code to have the program print your name, favorite color, and three hobbies to a new text file called “AllAboutMe” using PrintStream. Submit code.
Write the following java program: Desc Output the name and time of the runner who came...
Write the following java program: Desc Output the name and time of the runner who came in first, as well as the name and time of the runner who came in last in a marathon race (assuming there are no ties). Input A text file named marathon.txt containing the name and time of each participant in the following format (the file has at least 1 participant, name is just 1 word with no space, and name and time are separated...
Write a program in java processing. Write a program that does the following: · Assume the...
Write a program in java processing. Write a program that does the following: · Assume the canvas size of 500X500. · The program asks the user to enter a 3 digit number. · The program then checks the value of the first and last digit of the number. · If the first and last digits are even, it makes the background green and displays the three digit number at the mouse pointer. · If the two digits are odd, it...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT