Find Jobs
Hire Freelancers

Simple Visual Basic Exercises

$30-100 USD

Cancelled
Posted over 17 years ago

$30-100 USD

Paid on delivery
A few simple beginners Visual Basic projects to be completed using a console application. Projects include making a rock, paper scissors game and making and developing a program to solve the following: Today I will give you a penny, tomorrow I will give you two pennies. I will then keep doubling the amount that I give to you until the end of the month is reached. How much will you have? Full detail including example code can be seen in the deliverables. The assignment should not go much beyond basic coding as it's aim is to introduce the fundamentals such as case structures, algorithms etc. To be completed asap (within 24 hours if possible) ## Deliverables **Introduction to Programming ** **Exercise One ** Design a psuedocode algorithm that will solve the following problem: *Today I will give you a penny, tomorrow I will give you two pennies. I will then keep doubling the amount that I give to you until the end of the month is reached. How much will you have?* **Things to consider** What is the current day? Day 1, 2 or maybe 17. What is the current Month (How many days? 28, 29, 30, 31) **Exercise Two** Based upon your algorithm from exercise one, and the techniques presented from previous lectures and practical exercises, write a program that will calculate and display the results (don’t worry about formatting output for now). **Exercise Three** Examine the program code on the following page. (Note I have taken most of the program comments out to save space). • The changes that you should note have been made to function and procedure calls in “Main()??. A new parameter is now present “MonthDays??. See if you can establish why we need this variable. • Most of the changes have been made in the “GetUserInput procedure??. I have given you a start (idea) of how to process the days and months that are entered by the user. • Now also present, is minimal error checking (this will need to be improved eventually. • The program actually runs. But, is correct? (Testing and Debugging). • See if you can use/improve this code to fit into your current pennies application • How can we improve the design of the program? • Is it solving our problem? • Think about error checking. Sub Main() Dim Day, Month, MonthDays, Leap As Integer Dim Result As Long Call GetUserInput(Day, Month, MonthDays, Leap) Result = PennyCalc(Day, Month, MonthDays, Leap) Call DisplayResults(Day, Month, Leap, Result) [login to view URL]("Press enter to Quit") [login to view URL]() End Sub Sub GetUserInput(ByRef Day As Integer, ByRef Month As Integer, ByRef MonthDays As Integer, ByRef Leap As Integer) ‘******************************************************************* Dim LeapTemp As Integer [login to view URL]() ' Clear the screen [login to view URL]("**************************************") [login to view URL]("* *") [login to view URL]("* Get The User Input *") [login to view URL]("* *") [login to view URL]("**************************************") Leap = LeapCalc(LeapTemp) [login to view URL]("Enter the Month as a number") Month = [login to view URL]() 'get the Month number from the user [login to view URL]("Enter the Day of the month as a number") Day = [login to view URL]() 'get the day number from the user If Month = 2 And Leap = 0 Then If Day > 28 Then [login to view URL]() [login to view URL]("Please enter a valid number for February") [login to view URL]("Press the Enter key to retry") [login to view URL]() Call GetUserInput(Day, Month, MonthDays, Leap) 'force the user to re-enter End If End If If Month = 2 And Leap = 1 Then MonthDays = 29 End If Select Case Month Case 4, 5, 9, 11 MonthDays = 30 Case 1, 3, 5, 7, 8, 10, 12 MonthDays = 31 End Select End Sub Function PennyCalc(ByRef Day As Integer, ByRef Month As Integer, ByRef MonthDays As Integer, ByRef Leap As Integer) As Long Dim counter As Integer Dim PennySum As Long PennySum = 1 [login to view URL]("Sum is = to " & PennySum) For counter = Day To MonthDays PennySum = PennySum * 2 [login to view URL]("Sum is = to " & PennySum) Next Return PennySum End Function ‘********************************************************************** Sub DisplayResults(ByRef Day As Integer, ByRef Month As Integer, ByRef Leap As Integer, ByRef Result As Long) [login to view URL]("The Day of the month is = Day " & Day) [login to view URL]("The Month number = " & Month) [login to view URL]("Leap Status = " & Leap) [login to view URL]("The Total = " & Result) End Sub *********************************************************************** Function LeapCalc(ByRef Leap As Integer) As Integer Return 0 End Function 1. Revisit the design and amend where necessary. 2. Complete the GetUserInput Procedure 3. Complete the LeapCalc Function **Exercise Four ** You are required to develop a program which aims to emulate the popular “playground?? game called “Scissors ??" Paper ??" Stone??. The game will involve 2 players ??" the computer and the user. The Rules of Scissors-Paper- Stone: Both players (in this case the computer and you) select (without each other knowing) a choice between one and three: 1. Scissors, 2. Paper or 3. Stone,. If both players picked the same number, the result is draw. Otherwise one of the players wins, that is, considering the rules of the game below: Stone beats Scissors (because stone blunts scissors), Scissors beat Paper (because scissors cuts paper) and Paper beats Stone (because paper wraps stone) The winner gets one point. Of course, in the computer game, the choices are decided by random numbers (see the example procedure on the VLE for week nine or consult your book for random number generation), which are generated by the program, in the range 1 to 3, i.e. 1- for scissors, 2- for paper and 3- for stone. The program must (besides the basic functionality) • Distinguish between entries ??" that is display user names (computer and opponent) • Inform the user of the result of each game, e.g. win, draw, lose etc. Also the reason for the latter.(“Because scissors cuts paper?? etc) • Have a maximum of ten games per session ??" followed by the option “do you want to continue?? • Display the number of games played in the current session and who won the overall session. It is important for each exercise to be completed using the fundamental Visual Basic functions which are accessable to beginners, any further questions please ask ## Platform Visual Basic Express -Console Application
Project ID: 3959356

About the project

12 proposals
Remote project
Active 17 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
12 freelancers are bidding on average $52 USD for this job
User Avatar
See private message.
$85 USD in 1 day
5.0 (99 reviews)
7.0
7.0
User Avatar
See private message.
$85 USD in 1 day
5.0 (22 reviews)
4.1
4.1
User Avatar
See private message.
$34 USD in 1 day
5.0 (18 reviews)
3.2
3.2
User Avatar
See private message.
$85 USD in 1 day
4.4 (5 reviews)
3.3
3.3
User Avatar
See private message.
$34 USD in 1 day
4.3 (20 reviews)
3.2
3.2
User Avatar
See private message.
$25.50 USD in 1 day
4.8 (5 reviews)
2.3
2.3
User Avatar
See private message.
$34 USD in 1 day
5.0 (1 review)
2.2
2.2
User Avatar
See private message.
$5.95 USD in 1 day
5.0 (4 reviews)
1.7
1.7
User Avatar
See private message.
$67.15 USD in 1 day
4.5 (2 reviews)
0.0
0.0
User Avatar
See private message.
$25.50 USD in 1 day
0.5 (2 reviews)
0.0
0.0
User Avatar
See private message.
$63.75 USD in 1 day
0.5 (1 review)
0.0
0.0
User Avatar
See private message.
$85 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED KINGDOM
Leigh, United Kingdom
5.0
4
Member since Apr 20, 2007

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.