Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have already done the part of Estsingle, but I don't know how to write the EstBatch. I JUST NEED THE VBA CODE FOR THIS

I have already done the part of Estsingle, but I don't know how to write the EstBatch. I JUST NEED THE VBA CODE FOR THIS QUESTION. Please help me. You have just been hired by Olympus Tours (OT), a bus rental company located in Orem, Utah. OT provides buses for groups such as schools, family reunions, and travel clubs. The smallest group OT will bus is 20 people and the largest group is 120 people. Two types of buses are available for use: small buses (25 maximum riders per bus) and large buses (60 maximum riders per bus). Assume that OT has access to all of the small and large buses it needs. Table 1. Bus Combinations 0 # of Buses Option Riders Small Big| Min 2011 Max 25 Min 26220 Max 50 Min 5131 Max 60 Min 61411 Max 85 Min 8652 Max12000 OT's pricing structure is as follows. The base price (BP) is calculated by multiplying the number of people (P) included in the trip by a per-person base rate (PPBR). BP = P * PPBRThe base price covers trips up to and including five hours in duration. Customers are charged extra for tours that last longer than 5 hours. For example, a bus rented for 6.5 hours would have 1.5 overtime hours (OH). The maximum number of overtime hours per day is four, which means any trip lasting nine hours or more has the same number of overtime hours regardless of the duration of time that exceeds 9 hours. The overtime charge (OC) is calculated by multiplying the base price (BP) by the overtime hours (OH) multiplied by the extra hourly percentage (EHP) as follows: OC = BP * OH * EHP Table 2 shows some example price calculations that include partial hours. Table 2 Example Pricing Calculations 0.4 Number of Per-Person Base Base Overtime Extra Hourly Overtime Total Hours People Rate Price Hours Percent Charge Price P PPBR* BP OH EHP OC 20 $10 $2005.425% $20 $22025 $12 $3006.61.625% $120 $42030 $8 $24011.34.025% $240 $48035 $7 $2455.40.430% $29 $27445 $15 $6756.61.630% $324 $99950 $5 $25011.34.030% $300 $550 Note: *These numbers are not calculated in your code. Your sub should simply take whatever value for PPBR and EHP that is given in the setup portion of the single estimate and use that in your calculations. These are just example values you can use to test your outputs afterward. Your task is to create both (1) a flowchart and (2) a VBA program in Excel that will pick the right number of buses and that will calculate the correct price for the number of people and hours specified.Because the pricing parameters (PPBR and EHP) are somewhat stable, they are stored in the setup section. When the program runs (both the single and the batch), it should obtain the values for PPBR and EHP from the Setup section. The value of PPBR and EHP should be whatever the value of cells C22, and C23 are at the time it runs (this can be any values you choose). Do not hardcode these values in your code. Based on the values in the setup section and the number of people and hours specified, your program should calculate the correct outcomes. Your program should work correctly for single-trip estimates and for a batch of estimates. Your program should only pull values from the worksheet. You should not be using input boxes. Single-Trip Estimates. The program should work when the user wants to estimate one trip at a time. For a single trip, the user enters inputs directly into the [User Form] tab and presses the Run Single button. In this scenario, the user will enter the number of people (P) and the tour duration in hours (H) into the appropriate cells in the User Form. Your program should then use the pricing parameters (PPBR and EHP) to calculate the amount the customer will be charged per day. Note: if the user requests fewer than 20 or greater than 120 passengers, the user should see a pop-up message that indicates that they've selected too few or too many passengers and the outputs should all be set to zero. Figure 1 shows the (User Form] tab. Do not worry too much about the format of your numbers in cells C13:C18just be sure to declare your variables as the specified type. If there is a multi-day tour, the program will be run for each day of the multi-day tour. Thus your program does not need to support calculations for more than one day at a time. Figure 1: [User Form] TabE A 5 ZA P H AT Run Single B D 2.3 Olympus Tours 45 Inputs 6 Customer Name Stanfield Grop 7 Date of Tour 1/5/2017 Date 89 Number of People 120 Integer 10 Number of Hours H 10 Single 1112 Outputs 13 Number of Small Busses NS 0 Integer 14 Number of Large Busses NL 2 Integer 15 Base Price BP 1200 Currency 16 Overtime Hours OH 4 Single 17 Overtime Charge OC 1200 Currency 18 Total Price $2,400.00 Currency 192021 Setup 22 Per-person Base Rate PPBR $10 Currency 23 Extra Hourly Percent EHP 25% Single Run BatchThe [Batch Input] tab. Figure 2 explains the data on the [Batch Input] tab. All passenger inputs for Batch Estimates will be between 20 and 120 people. Figure 2: [Batch Input] Tab Name B 1/5/2017 Trip Date 1 Davis Schools 261+3645 Willie Wrestling Number of people Hours 1/6/2017 The [Batch Output] tab. Figure 3 shows how your program should organize the outputs on the [Batch Output] tab. Figure 3: [Batch Output] Tab. 1 Customer Date 2 Davis Schools 1/5/20173 Willie Wrestling 1/6/20174 Dahle Reunion 1/6/20175 Stanfield Group 1/7/2017 Instructions User Form D E G H 1 People Hours PPBR EHP NS NL BP OH 616 $10.0025%11 $610.001204 $10.0025%10 $200.000557 $10.0025%01 $550.00212010 $10.0025%02 $1,200.004 Batch Input Batch Output OC TP $152.50 $762.50 $0.00 $200.00 $275.00 $825.00 $1,200.00 $2,400.00+ READYOption Explicit Sub EstSingle() Dim num_people As Integer Dim num_big_bus As Integer Dim num_small_bus As Integer Dim BP As Currency Dim PPBR As Currencyl Dim OC As Currency Dim TP As Currency Dim OH As Integer Dim EHP As Single Sheets("User Forme").Activate OH = Range("C10")-5 Range("C16")= OH = PPBR = Range("C22") EHP = Range("C23") num_people = Range("C9") If num_people <20 Then Call MsgBox("You select too few passangers") End If If num_people >120 Then Call MsgBox("You select too many passangers") End If If num_people >=20 And num_people <=25 Then num_small_bus =1 num_big_bus =0 End If If num_people >=26 And num_people <=50 Then num_small_bus =2 num_big_bus =0 End If If num_people >=51 And num_people <=60 Then num_small_bus =0num_big_bus =1 End If If num_people >=60 And num_people <=85 Then num_small_bus =1 num_big_bus =1 End If If num_people >=86 And num_people <=120 Then num_small_bus =0 num_big_bus =2 End If Range("C13")= num_small_bus Range("C14")= num_big_bus BP = num_people * PPBR Range("C15")= BP OC = BP OH EHP Range("C17")- OC TP = BP + OC Range("C18")= TP End Sub Sub EstBatch Sheets("Batch Input").Activate Sheets("Batch Output"). Activate Dim i As Integer i =2 While ((Range("Ai")>0)) End Sub

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

3. How has e-commerce transformed marketing?

Answered: 1 week ago