Go Back   Overclock3D Forums > [OC3D] Hardware & Software > Software Section > OS & Apps
Reply
 
Thread Tools Display Modes
 
  #1  
Old 08-10-07, 08:21 AM
mrapoc mrapoc is offline
OC3D Elite
 
Join Date: Jul 2006
Location: Shropshire
Posts: 5,669
Ill guy needs help programming

I've been off for 6 days with suspected meningitis but has luckily turned out to be a really strong flu virus variant (kinda scared me when I had a massive rash but it turned out to be non harmful). I've found out my event-driven programming course has been given homework to investigate on.

I would appreciate it if someone gave a bit of time just to write it (only needs to be simple like this is our fourth week doing it) plus to comment on each major part so I can understand whats going on ('insert comment)

I'm still not 100% so I'm goin to have to start looking at it from now even if i dont go back till later in the week.

Much appreciated (its visual basic express/studio that we use)

Quote:
Week 4 Example Questions (using IFs and Loops)

You are expected to show these to your tutor at your next lesson. It is advisable that you have a go

at these questions, and try and work them out by yourself, as it will aid your learning of the subject.

If you don’t complete these in your lesson, complete them at home.

• Remember to add comments throughout your programs.

• Concentrate on the algorithms (the steps needed to solve the problem) - don't be overly

fussy about the interface.

• Be prepared to use pencil and paper to work out how a problem might be solved.

• Test your program thoroughly.

1. Write a program that will input 3 whole numbers from a user, and multiply them together.

Output the result to the console.

2. Write a program that will ask the user for their name and year of birth, and will then output

a suitable greeting message, telling the person their calculated age.

3. Add to the age program above, where different output is given depending on the users

calculated age. For example, if they are 17 or over, tell them they can drive, if they are 18 or

older also tell them they can drink and vote etc. But if they are less than 1 or older than 130

tell them they may be mistaken, and ask them to input their age again.

4. Write a program to print the numbers from 1 to 10 and their squares:

1 1

2 4

3 9

...

10 100

5. Write a program to print this triangle (don’t just use a set of print statements, program it!):

*

**

***

****

*****

******

*******

********

*********

**********
I'm going back to bed, will check soon...thanks

__________________
Reply With Quote
  #2  
Old 08-10-07, 08:43 AM
Marcus Marcus is offline
OC3D Crew
 
Join Date: Sep 2007
Posts: 654
I've got some very similar programs to those from when I was at uni but im struggling to find them at the moment, i'll keep lookin though.
Reply With Quote
  #3  
Old 08-10-07, 01:35 PM
Joe Joe is offline
OC3D Elite
 
Join Date: Mar 2005
Posts: 2,592
OK it works like this >> What Lang are u using -- if its VBASIC I wont be supplying you with the fully formatted Grammaticaly correct code

this nothing personal ... its just a dog -- and I use Linux and refuse to install Mono aka

'project sell out and allow proliferation of some poorly conceived M$ scumcode'

-- sh1t for c# they ripped off java (a smart move as every uni loves teaching Java ) [Stopped my self goin off in a rant]

If it is C# ill give u java code -- the keywords/syntax are identical ... classes are not-- so u will neeed to edit some junk

eg. Change System.Out.print ("foo"); to Console.Write("foo");

I have to go to class soon but i will help u when i get back
__________________
Quote:
I got 600 TFLOPS out a potato that i put in a Soc 775 mobo , proof? -- here is a picture of a piece of lint , surley that will suffice
OC3D ScreenSavers ::
|Available Here|

Got an Ipod? :: |Check This Out|


Isabelle Loves OC3D :: |THIS MUCH|





Reply With Quote
  #4  
Old 08-10-07, 01:58 PM
mrapoc mrapoc is offline
OC3D Elite
 
Join Date: Jul 2006
Location: Shropshire
Posts: 5,669
its vb lol

i use visual basic express at home and the studio at college (no difference apart from express is free)
__________________
Reply With Quote
  #5  
Old 08-10-07, 02:18 PM
nunzio nunzio is offline
OC3D Crew
 
Join Date: Feb 2007
Posts: 774
I did VB in college, cant remember a single bit of it.
Reply With Quote
  #6  
Old 08-10-07, 02:21 PM
Rastalovich's Avatar
Rastalovich Rastalovich is offline
OC3D Elite
 
Join Date: Aug 2006
Location: Testing hardware somewhere
Posts: 11,416
Quote:
Originally Posted by name='Joe'
OK it works like this >> What Lang are u using -- if its VBASIC I wont be supplying you with the fully formatted Grammaticaly correct code

this nothing personal ... its just a dog -- and I use Linux and refuse to install Mono aka

'project sell out and allow proliferation of some poorly conceived M$ scumcode'

-- sh1t for c# they ripped off java (a smart move as every uni loves teaching Java ) [Stopped my self goin off in a rant]

If it is C# ill give u java code -- the keywords/syntax are identical ... classes are not-- so u will neeed to edit some junk

eg. Change System.Out.print ("foo"); to Console.Write("foo");

I have to go to class soon but i will help u when i get back
The way I used to help peoples in college tbh.

They`d have problems to sort out in Pascal, and as opposed to `doing it for them`, I`d give it to them in C so atleast they`d have to wrap their heads around it to make sure it worked as they wanted.
__________________


Reply With Quote
  #7  
Old 08-10-07, 03:08 PM
nrage nrage is offline
Advanced Member
 
Join Date: Jul 2007
Posts: 309
You really should do this yourself, or at least spend a while hacking around with it and trying to make it do even more.

Task 3 might not be exactly what is required, the wording isn't very specific as to the exact output.

I'm not a VB developer but this compiles and runs in my Visual Studio 2005.

Code:
' Your Homework in Visual Basic.

Module Homework

Sub Main()

' Task 1

Dim N1 As Integer

Dim N2 As Integer

Dim N3 As Integer

' Read 1st number

Console.Write("Enter #1: ")

N1 = Console.ReadLine()

' Read 2nd number

Console.Write("Enter #1: ")

N2 = Console.ReadLine()

' Read 3rd number

Console.Write("Enter #1: ")

N3 = Console.ReadLine()

' Multiply and output

Console.WriteLine(N1 * N2 * N3)

' Task 2

Dim Name As String

Dim Year As Integer

Dim Age As Integer

' Ask for name

Console.Write("Enter your name: ")

Name = Console.ReadLine()

' Ask for birth year

Do

Console.Write("What year were you born: ")

Year = Console.ReadLine()

' Calculate age in years

Age = Today().Year - Year

' Task 3

If (Age < 1 Or Age > 130) Then

Console.WriteLine("You must be mistaken, please try again")

Else

Exit Do

End If

Loop

' Task 2; Output greeting

Console.WriteLine("Hello " + Name + " you are " + CStr(Age) + " years old.")

' Task 3

' If 17 or older output can drive

If (Age >= 17) Then

Console.WriteLine("You can drive!")

End If

' If 18 or older output can drink and vote

If (Age >= 18) Then

Console.WriteLine("You can drink and vote!")

End If

' Task 4

Dim i As Integer

' Loop from 1 to 10 (inclusive)

For i = 1 To 10

' Output number and it's square

Console.WriteLine(CStr(i) + " " + CStr(i * i))

Next

' Task 5

Dim j As Integer

' Loop from 1 to 10 (inclusive)

For i = 1 To 10

' Loop from 1 to i (inclusive)

For j = 1 To i

' Output * without new line

Console.Write("*")

Next

' Output newline

Console.WriteLine()

Next

End Sub

End Module
Reply With Quote
  #8  
Old 08-10-07, 03:23 PM
mrapoc mrapoc is offline
OC3D Elite
 
Join Date: Jul 2006
Location: Shropshire
Posts: 5,669
Cheers, yea that wot i hope to do while ill, look through it so i know exactly what it does. Its just missed the lesson on loops due to illness and i dont feel up to working it out yet

ill give it a go
__________________
Reply With Quote
  #9  
Old 08-10-07, 03:36 PM
ai_01 ai_01 is offline
OC3D Crew
 
Join Date: Jan 2006
Posts: 945
Go on network and find somebody else's! rename and submit!
Reply With Quote
  #10  
Old 08-10-07, 03:58 PM
mrapoc mrapoc is offline
OC3D Elite
 
Join Date: Jul 2006
Location: Shropshire
Posts: 5,669
lol its jsut home based research. not important just to recap, and in my case learn cause i missed it lol
__________________
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump






All times are GMT. The time now is 02:56 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.