Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The only way Santa can hit his production targets is to enslave elves. Currently, he has 16,384 slaves. To keep order, Santa formed the Greater

The only way Santa can hit his production targets is to enslave elves. Currently, he has 16,384 slaves. To keep order, Santa formed the Greater Elf Security and Tactical Police, aka the Gestapo. The Gestapo has 512 overseers, 16 captains, and General Huggy Buns, the head of the force.

Every year, Santa resupplies the Gestapo with uniforms, whips, and tasers. Every Gestapo member gets one new uniform every year, except for General Huggy Buns, who gets three.

The number of whips and tasers Santa buys depends on the unrest forecast (UF). If UF is low, heres how many items each Gestapo member gets:

Overseers Captains General
Whips 1 3 5
Tasers 1 2 4

If UF is moderate, heres how many items each Gestapo member gets:

Overseers Captains General
Whips 2 5 9
Tasers 2 4 8

If UF is high, heres how many items each Gestapo member gets:

Overseers Captains General
Whips 3 8 16
Tasers 3 7 15

This code gives unit prices for every item Santa buys:

uniformOverseerUnitPrice = 129.5

uniformCaptainUnitPrice = 289.25

uniformGeneralUnitPrice = 1295.5

whipUnitPrice = 87.5

taserUnitPrice = 429

Write a program that takes the UF as input, and shows counts and totals, as shown in this example:

image text in transcribed

Hints:

Divide your code into input, processing, and output.

Try doing just the uniforms to start with. Get that right, then add the other stuff.

Do everything with VBA, of course. No formulas in the worksheet. Here is my code now, it's incorrect for some reason I can't figure out.

Option Explicit

Private Sub CommandButton1_Click() 'Declare variables Dim UF As String Dim unNum As Integer Dim whipNum As Long Dim tasNum As Long Dim unCost As Long Dim whipCost As Long Dim tasCost As Long Dim totNum As Integer Dim totCost As Long

'Get data

UF = LCase(Cells(3, 2)) If UF "low" And UF "moderate" And UF "high" Then MsgBox "you must enter low moderate or high" End End If If UF = "low" Then whipNum = 555 tasNum = 584

ElseIf UF = "moderate" Then whipNum = 1113 tasNum = 1096 ElseIf UF = "high" Then whipNum = 1680 tasNum = 1663 End If

'compute unNum = 531 unCost = 74818.5 tasCost = 429 * tasNum whipCost = 87.5 * whipNum totNum = whipNum + unNum + tasNum totCost = unCost + tasCost + whipCost

'output Cells(7, 2) = unNum Cells(8, 2) = whipNum Cells(9, 2) = tasNum Cells(11, 2) = totNum Cells(7, 3) = unCost Cells(8, 3) = whipCost Cells(9, 3) = tasCost Cells(11, 3) = totCost

End Sub

SAMPLE: image text in transcribed

2 1 Santa's security purchase 3 UF 4 low, moderate or high 5 6 7 Uniforms 74818.5 8 Whips 9 Tasers 10 11 Total ow Run Number Cost 65 49437.5 548 235092 1644359348 2 1 Santa's security purchase 3 UF 4 low, moderate or high 5 6 7 Uniforms 74818.5 8 Whips 9 Tasers 10 11 Total ow Run Number Cost 65 49437.5 548 235092 1644359348

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

Show that ex is strictly increasing on +.

Answered: 1 week ago

Question

Distinguish between supervised and unsupervised learning models.

Answered: 1 week ago

Question

Determine the amplitude and period of each function.

Answered: 1 week ago