The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Programming Challenges Reference to Visual Basic 2012 Page 346 assignmentsÂ
1) Sum of Numbers Create an application that displays a form similar to the one shown in Figure 5-44. When the Enter Numbers button is clicked, the application should display the input box shown in Figure 5-45. VideoNote The Sum of Numbers Problem The input box asks the user to enter a positive integer value. Notice that the default input value is 10. When the OK button is clicked, the application should display a message box with the sum of all the integers from 1 through the value entered by the user, as shown in Figure 5-46. Figure 5-44 Sum of Numbers form Figure 5-45 Sum of Numbers input box Figure 5-46 Sum of Numbers message box If the user enters a negative value, the application should display an error message. Use the following test data to determine if the application is calculating properly: ValueSum 515 1055 20210 1005050
Â
'************************************************************************************'Project: *'Program Name: Amusement Park Tickets *'Couse: Programming Fundamental CIS200 *'Purpose: This Windows application will calculate the cost of the amusement park tickets,'the type of club memberships accepted are AAA 15%, AARP 17%, and Military ID 20% o±'full *'purchase cost.'************************************************************************************Option Strict OnPublicClassfrmAParkTicketsPrivateSubbtnCalculate_Click(senderAsObject, eAsEventArgs)HandlesbtnCalculate.Click'The btnCalculate the event handler calculate the single day tickets'for amusement park.'Declaration SelctionDimdecTicketsPurchasedAsDecimalDimdecSingleDayTicketsAsDecimalDimdecCostEstimateAsDecimalDimdecRegularAsDecimal= 72DDimdecAAAAsDecimal= 61.2D' -15% of RegularDimdecAARPAsDecimal= 59.76D'-17% of regular per the requirementDimdecMilitaryAsDecimal= 57.6D'-20% of regular'Check to see numeric valueIfIsNumeric(txtTicketsPurchased.Text)ThendecTicketsPurchased =Convert.ToDecimal(txtTicketsPurchased.Text)IfdecTicketsPurchased > 0ThenIfradRegular.CheckedThendecSingleDayTickets = decRegularElseIfradAAA.CheckedThendecSingleDayTickets = decAAAElseIfradAARP.CheckedThendecSingleDayTickets = decAARPElseIfradMilitary.CheckedThendecSingleDayTickets = decMilitaryEndIf'Calculate and display the cost estimatedecCostEstimate = decTicketsPurchased * decSingleDayTicketslblTicketAmt.Text = decCostEstimate.ToString("C")Else'Display error message, if user entered a negative valueMsgBox("You entered"& decTicketsPurchased.ToString() &". Enter a Positive Number", ,"Input Error")txtTicketsPurchased.Text =""txtTicketsPurchased.Focus()EndIfElse'Display error message, if user entered a nonnumeric valueMsgBox("Enter the only positive numeric value!", ,"Input Error")txtTicketsPurchased.Text =""txtTicketsPurchased.Focus()EndIfEndSubPrivateSubbtnClear_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesbtnClear.Click'This event handler will execute when the user click clear button.'It clears textbook to re-enter, resets the radiotxtTicketsPurchased.Clear()
Attachments: