Find Jobs
Hire Freelancers

Simple Visual Basic Exercises

$30-100 USD

Zrušeno
Zveřejněno před více než 17 roky

$30-100 USD

Zaplaceno při doručení
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
IČ projektu: 3959356

O projektu

12 nabídky
Vzdálený projekt
Aktivní před 17 roky

Chcete si vydělat nějaké peníze?

Výhody podávání nabídek na Freelancer

Stanovte si rozpočet a časový rámec
Získejte za svou práci zaplaceno
Načrtněte svůj návrh
Registrace a podávání nabídek je zdarma
12 freelanceři nabízejí v průměru $52 USD za tuto práci
Avatar uživatele
See private message.
$85 USD v 1 dni
5,0 (99 recenze)
7,0
7,0
Avatar uživatele
See private message.
$85 USD v 1 dni
5,0 (22 recenze)
4,1
4,1
Avatar uživatele
See private message.
$34 USD v 1 dni
5,0 (18 recenze)
3,2
3,2
Avatar uživatele
See private message.
$85 USD v 1 dni
4,4 (5 recenze)
3,3
3,3
Avatar uživatele
See private message.
$34 USD v 1 dni
4,3 (20 recenze)
3,2
3,2
Avatar uživatele
See private message.
$25,50 USD v 1 dni
4,8 (5 recenze)
2,3
2,3
Avatar uživatele
See private message.
$34 USD v 1 dni
5,0 (1 recenze)
2,2
2,2
Avatar uživatele
See private message.
$5,95 USD v 1 dni
5,0 (4 recenze)
1,7
1,7
Avatar uživatele
See private message.
$67,15 USD v 1 dni
4,5 (2 recenze)
0,0
0,0
Avatar uživatele
See private message.
$25,50 USD v 1 dni
0,5 (2 recenze)
0,0
0,0
Avatar uživatele
See private message.
$63,75 USD v 1 dni
0,5 (1 recenze)
0,0
0,0
Avatar uživatele
See private message.
$85 USD v 1 dni
0,0 (0 recenze)
0,0
0,0

O klientovi

Pochází z UNITED KINGDOM
Leigh, United Kingdom
5,0
4
Členem od dub 20, 2007

Ověření klienta

Díky! Poslali jsme vám e-mailem odkaz pro získání kreditu zdarma.
Při odesílání e-mailu se něco pokazilo. Zkuste to prosím znovu.
Registrovaných uživatelů Zveřejněných projektů
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Načítání náhledu
Bylo uděleno povolení ke geolokaci.
Vaše doba přihlášení vypršela a byli jste odhlášeni. Přihlaste se znovu.