Help with console application.. plz

mr06

Member
Joined
May 1, 2006
Messages
12
Programming Experience
Beginner
Hey there,

I was wondering if anyone can help me to write a console program using VB.net that asks the user 2 decimal numbers.

The program calculates total, average amd maximum value.

Example:

Enter number 1: __
Enter number 2: __
Enter number 3: __

TOTAL: __
AVERAGE: __
MAXIMUM: __

Wud appreciate it if any1 wud get me a started or provide me with a solution..I need to knw this urgently..

thanx n i hope this is clear enuff..
 
No solutions for what is almost certainly a homework assignment. What you want are the Console.Write, Console.WriteLine and Console.ReadLine methods. You would use Console.Write to display a line of text and leave the cursor on the same line. Console.ReadLine would then wait until the user presses the Enter key and read what they entered beforehand. You would then need to convert that string to a number. Do this three times to get your three values, do your calculations and then use Console.WriteLine to display your output.
 
Plz try to understand this is not hmwk..I swear to god i need to learn this im having trouble getting started and i didnt understand you when u explained by words i need the codes if u may along with an explanation if u can otherwise its ok no need for explanation i can figure it out myself.. So plz give me some assistance it wont hurt u, im learning this on my own so its not any hmwk
 
No offence mr, but that is a typical homework assignment - and most people
whom want to learn VB.NET programming on their own usually starts with
something different than things like that. He already gave you hints to
solve most of the task already.

VB.NET:
Console.WriteLine("Enter a number: ")
Dim intInitialNumber As Integer = Integer.Parse(Console.ReadLine.ToString)
The above 2 lines of codes cover the basics of your whole question, by
testing that and learning how it works, you will be able to do what you
ask for in your question.
 
What JCMILHINNEY says, is completly correct, these kind of solutions can be programmed in less then 5 minutes (10 if you use the internet. I will give just a little help with the Average and the Maximum. !!

The numbers (nr1, nr2 and nr3 you get with console.readline
Dim nums() As Integer = {nr1, nr2, nr3}
Array.Sort(nums) 'Sort, first number is minimum.
Array.Reverse(nums) 'Sort, first number is maximum.
' Now you have your maximum number

Average is as follows (Nr1+Nr2+Nr3) /3

Regards
MJCM
 
Back
Top