Answered step by step
Verified Expert Solution
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 people and the largest group is people. Two types of buses are available for use: small buses maximum riders per bus and large buses maximum riders per bus Assume that OT has access to all of the small and large buses it needs. Table Bus Combinations # of Buses Option Riders Small Big Min Max Min Max Min Max Min Max Min Max 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 perperson 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 hours. For example, a bus rented for hours would have 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 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 shows some example price calculations that include partial hours. Table Example Pricing Calculations Number of PerPerson Base Base Overtime Extra Hourly Overtime Total Hours People Rate Price Hours Percent Charge Price P PPBR BP OH EHP OC $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ 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 a flowchart and 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 C and C 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 singletrip estimates and for a batch of estimates. Your program should only pull values from the worksheet. You should not be using input boxes. SingleTrip 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 or greater than passengers, the user should see a popup message that indicates that they've selected too few or too many passengers and the outputs should all be set to zero. Figure shows the User Form tab. Do not worry too much about the format of your numbers in cells C:Cjust be sure to declare your variables as the specified type. If there is a multiday tour, the program will be run for each day of the multiday tour. Thus your program does not need to support calculations for more than one day at a time. Figure : User Form TabE A ZA P H AT Run Single B D Olympus Tours Inputs Customer Name Stanfield Grop Date of Tour Date Number of People Integer Number of Hours H Single Outputs Number of Small Busses NS Integer Number of Large Busses NL Integer Base Price BP Currency Overtime Hours OH Single Overtime Charge OC Currency Total Price $ Currency Setup Perperson Base Rate PPBR $ Currency Extra Hourly Percent EHP Single Run BatchThe Batch Input tab. Figure explains the data on the Batch Input tab. All passenger inputs for Batch Estimates will be between and people. Figure : Batch Input Tab Name B Trip Date Davis Schools Willie Wrestling Number of people Hours The Batch Output tab. Figure shows how your program should organize the outputs on the Batch Output tab. Figure : Batch Output Tab. Customer Date Davis Schools Willie Wrestling Dahle Reunion Stanfield Group Instructions User Form D E G H People Hours PPBR EHP NS NL BP OH $ $ $ $ $ $ $ $ Batch Input Batch Output OC TP $ $ $ $ $ $ $ $ READYOption Explicit Sub EstSingle Dim numpeople As Integer Dim numbigbus As Integer Dim numsmallbus 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 SheetsUser Forme"Activate OH RangeC RangeC OH PPBR RangeC EHP RangeC numpeople RangeC If numpeople Then Call MsgBoxYou select too few passangers" End If If numpeople Then Call MsgBoxYou select too many passangers" End If If numpeople And numpeople Then numsmallbus numbigbus End If If numpeople And numpeople Then numsmallbus numbigbus End If If numpeople And numpeople Then numsmallbus numbigbus End If If numpeople And numpeople Then numsmallbus numbigbus End If If numpeople And numpeople Then numsmallbus numbigbus End If RangeC numsmallbus RangeC numbigbus BP numpeople PPBR RangeC BP OC BP OH EHP RangeC OC TP BP OC RangeC TP End Sub Sub EstBatch SheetsBatch Input"Activate SheetsBatch Output" Activate Dim i As Integer i While RangeAi End Sub
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started