Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

VB.NET coding problem (3) You are offered two salary options for a certain number of work days. Option 1: $300 per day. Option 2: $1

VB.NET coding problem

image text in transcribed

(3) You are offered two salary options for a certain number of work days. Option 1: $300 per day. Option 2: $1 the first day, S2 the second day, $4 the third day, $8 the fourth day, and so on, with the amount doubling each day. Define a subroutine to determine which option pays better. DO NOT DEFINE AN EVENT HANDLER. (10 Points) Sub GetBetterSalaryOption (ByVal day As Integer) Dim option1 Payment As Double = 0, option2 Payment As Double=0 option Payment = 300* day Dim currentDayPayment As Double=0 For i As Integer = 1 To day Ifi = 1 Then currentDayPayment=1 Else current DayPayment= 2 * currentDayPayment End If option2Payment += currentDayPayment Next If option Payment option2Payment Then MsgBox("Option I pays better) Else if option2Payment > option 1 Payment Then MsgBox("Option I pays better) Else MsgBox("Two options pay the same") End If End Sub Alternative Solution: Sub Get BetterSalaryOption (ByVal day As Integer) Dim option 1 Payment option2 Payment As Integer "Calculate total salary in option ! option Payment = 300 * day Calculate total salary in option 2 option2Payment = (1-2 day) (-1) the sum of a geometric sequence If option Payment option2Payment Then MsgBox("Option I pays better") Else if option2Payment option Payment Then MsgBox("Option I pays better") Else MsgBox("Two options pay the same") End If 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

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions