Question

Programming Visual Basic 2010 Please post correct answer. Some of the questions I asked answered wrong...

Programming Visual Basic 2010

Please post correct answer. Some of the questions I asked answered wrong before.

Number Analysis: Create an application that reads the numbers from the file named NumberSet.txt .Your application should perform the following:
1) Display the total of the numbers
2) Display the average of the numbers
3) Display the highest number in the file.
4) Display the lowest number in the file.

Attachment: NumberSet.txt http://s000.tinyupload.com/?file_id=00184765431250246674

I need full programming code with all the comments and naming conventions.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

plz check it let me know your comments

Module Module1

Sub Main()

' declear veriables
Dim totalNumbers As Double = 0, avgNumbers As Double
' How to: Write to a Text File. You can change the path and
' file name to substitute text files of your own.
' Read each line of the file into a string array. Each element
' of the array is one line of the file.
Dim Numbers As String() = System.IO.File.ReadAllLines("C:\Users\KWV\Documents\visual studio 2012\Projects\ConsoleApplication6\ConsoleApplication6\NumberSet.txt")
' convert string array to double array
Dim doubleAryNumbers As Double() = Array.ConvertAll(Numbers, New Converter(Of String, Double)(AddressOf DoubleConverter))
'Dim cNumbers As Double() = Array.ConvertAll(Numbers, [Double].Parse)
' add numbers the file contents by using a foreach loop.
For Each Number As String In Numbers
totalNumbers = totalNumbers + Convert.ToDouble(Number)
Next
'calculate average total numbers
avgNumbers = totalNumbers / Numbers.Count()
'dispaly total of the numbers
System.Console.WriteLine("the total of the numbers: " & totalNumbers)
'dispaly average of the numbers
System.Console.WriteLine("the average of the numbers: " & avgNumbers)
'dispaly highest number in the file
System.Console.WriteLine("the highest number in the file: " & doubleAryNumbers.Max())
'dispaly lowest number in the file
System.Console.WriteLine("the lowest number in the file: " & doubleAryNumbers.Min())
System.Console.ReadKey()
End Sub
'convert string to double function
Private Function DoubleConverter(ByVal text As String) As Double
Dim value As Double = 0
Double.TryParse(text, value)
Return value
End Function
End Module


answered by: ANURANJAN SARSAM
Add a comment
Know the answer?
Add Answer to:
Programming Visual Basic 2010 Please post correct answer. Some of the questions I asked answered wrong...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please help me finish this, it is for Visual Basic . net in Visual studio 2010...

    please help me finish this, it is for Visual Basic . net in Visual studio 2010 (show pictures of code and of the form please) Lab #5 - Banking Account with Methods Submit Assignment Download Work file Download Runtime Be sure to include comments at the top of each procedure and at the top of the file. Be sure to use meaningful names for all buttons and labels. In this lab you will create a simple banking application that will...

  • I am in C++ programming, I need help with this assignments. The answer in this assignments...

    I am in C++ programming, I need help with this assignments. The answer in this assignments when I look for it it doesn't work in my visual studios. Can you please help me? I hardly have C in the class, if I fail I will fail the whole class and repeat this class again.   The file named Random.txt contains a long list of random numbers. Download the file to your system, then write a program that opens the file, reads...

  • Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it...

    Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it to a size equal to an assigned value of a variable, populate the array with a series of random numbers, output the array to a message box and to a worksheet. Instructions: - Review the variables already declared. You won't need others. - See comments in the code that will act as your guide. Add new code directly after each comment. - Assign a...

  • I need help regarding my Visual Basic code ISC/ITE 285 Homework Due: Monday, January 28 by...

    I need help regarding my Visual Basic code ISC/ITE 285 Homework Due: Monday, January 28 by 11:55 pm Create a text file named "Grades.txt" which will contain a list of numeric grades. Save the file in the projects Bin/Debug folder. A sample of the file contents is shown below: 80 96 95 86 54 97 Create a string array that will be populated from the file "Grades.txt" when the array is created (Class-level array). Also create a numeric array that...

  • hello i was given an assignment on object orientated programming and we were asked to use...

    hello i was given an assignment on object orientated programming and we were asked to use Microsoft word, Comments for significant parts should be coloured green. And can you recommend some videos too so i can understand it better with your help. i have some questions about this assignment given and was told to create in Microsoft word Name your file with your full name, e.g.. Jessica_Jones.docx or (arth). • Programs/codes must be properly indented and free of compile-time errors....

  • I'm falling behind on my hw and I can really use a hand with using structures...

    I'm falling behind on my hw and I can really use a hand with using structures in C,++ C++ Object Oriented Programming Programming Assignment #4 Structures Create a structure representing a student. The member variables should include student name, student ID, and four test grades for the student (an array of four grades as a member variable). Prompt the user to enter the name, ID and the four test results. Store all the data in the structure. Calculate the average...

  • Visual Basic Programming Step 1-2 not important, it's just file naming. 3. Form contains nine Labels,...

    Visual Basic Programming Step 1-2 not important, it's just file naming. 3. Form contains nine Labels, one TextBox, and three Button controls. You use labels to let user know what to enter and what will be displayed; TextBoxes to input a number between 1 and 99. Buttons to Calculate change. Clear Input and Exit program. See below Form Layout with Controls for more details 4. Declare variables to store the entered value in TextBox, and what will be displayed in...

  • Visual Basic Programming Step 1-2 not important, it's just file naming.

    Visual Basic Programming Step 1-2 not important, it's just file naming. 3. Form contains nine Labels, one TextBox, and three Button controls. You use labels to let user know what to enter and what will be displayed; TextBoxes to input a number between 1 and 99. Buttons to Calculate change. Clear Input and Exit program. See below Form Layout with Controls for more details 4. Declare variables to store the entered value in TextBox, and what will be displayed in...

  • Need some help I am not understanding this programming class at all. We are using Microsoft...

    Need some help I am not understanding this programming class at all. We are using Microsoft visual studio with python in console mode to complete these labs. Double-click to hide white space CIS115 Week 4 Lab Overview Title of Lab: Multiplication Table in Python Summary This week's lab is to create a simple multiplication table using nested loops and if statements. Prompt the user for the size of the multiplication table (from 2x2 to 10x10). Use a validation loop to...

  • If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but...

    If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but minor discrepancies may require you to adjust. If you are attempting this assignment using another version of Visual Studio, you can expect differences in the look, feel, and/or step-by-step instructions below and you’ll have to determine the equivalent actions or operations for your version on your own. INTRODUCTION: In this assignment, you will develop some of the logic for, and then work with, the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT