Newbie

  • Thread starter Thread starter Christian
  • Start date Start date
C

Christian

I am taking a vb.net class and I am stumped on how to approach the
following assignment. To be honest, I do not even know where to start.
If someone would help me with this code and help me discover what I am
missing, I would greatly appreciate it. The assignment is as follows:

Create a function, IsPositive, that takes an integer and returns True
if the integer is > 0, and False Otherwise

Create another function, Average, that takes a Single, and Integer. It
uses IsPositive, on the integer, and if the result is true, it returns
a string which represents the Single variable divided by the Integer,
Otherwise, it returns a string of "Error"

Create a Procedure, DisplayResult, that takes a single, and integer,
and passes them to the Average function above, and displays its result
in a messagebox with Ok button, Results in titlebar, and the
infomration icon. 20 Points

All variables above are passed by Value.

Make sure you use the conversion functions to change the data types to
the required type.

Thanks in advance!
 
Hi Christian,

Most regulars to this newsgroup avoid helping with homework in this
newsgroup. (When you had not told it is easy to see).

This is so easy that it almost in every language the same because it are all
functions while VBNet have as well Sub. However this are functions, so when
you do a google on "functions" you will find it endless.

First you can have a look at this website
http://samples.gotdotnet.com/quickstart/

Probably there is even a section functions in it.

I hope this helps?

Cor
 
At least you're honest, but .........

YOU CAN'T POSSIBLY BE SERIOUS, CAN YOU???

Look, I can understand why you might have some troubles, but asking to have
your homework done for you in this type of forum is pretty low. Don't you
have any friends in your class, or a study group that can assist you?

BTW, I have project at work that is difficult. Could someone here do it for
me, please? You'll get 85 points!!!

Bob Lehmann
 
* (e-mail address removed) (Christian) scripsit:
I am taking a vb.net class and I am stumped on how to approach the
following assignment. To be honest, I do not even know where to start.
If someone would help me with this code and help me discover what I am
missing, I would greatly appreciate it. The assignment is as follows:

Create a function, IsPositive, that takes an integer and returns True
if the integer is > 0, and False Otherwise

Create another function, Average, that takes a Single, and Integer. It
uses IsPositive, on the integer, and if the result is true, it returns
a string which represents the Single variable divided by the Integer,
Otherwise, it returns a string of "Error"

[...]

If you are using the VB.NET IDE, enter some of the keywords you mention
in your text and press F1. For example, 'Return', 'Integer', 'If', ...

Please understand that we won't do your homework for you. Homework is
given to learn something, or to learn where to look for an answer. If
you have some little questions, that's no problem and people here will
like to help you, but we won't do all your homework.
 
Hi Christian,

Public Function IsPositive(ByVal myInt as Integer) as Boolean
return CBool(myInt>0)
End Function

That should get you started. Then check out the following methods for your
remaining functions.

ToString, CStr, MessageBox.

I'd also suggest the most important thing you will learn from this exercise
is the difference between passing ByVal
and ByRef. Read up on both of these Keyword subjects as they are fundamental
concepts of programming.

I would also seek out additonal assistance from your tutor. The example you
have provided is very elementary and the fact that you dont know where to
start would suggest, you need to revisit some of the fundamentals.

This newsgroup is more for people learning/seeking answers to questions
surrounding the VB.net programming. It is not intended to teach you how to
program from scratch. For that you need perosnally assistance.

All the best
Richard
 
I'll do it!!!

How many pints of beer does 85 points equate to?!?! :))
_______________________
The Grim Reaper
 
Back
Top