I need help regarding my Visual Basic code
Below is the solution:
Imports System.IO
Public Class frmMain
Dim strFileLine As String
Dim arrLines As New ArrayList() 'array list to
store value
Dim objReader As System.IO.StreamReader
Dim iRowCount As Integer = 0 ' Variable to hold
the total
Private Sub frmMain_Load(sender As Object, e
As EventArgs) Handles MyBase.Load
End Sub
Private Sub btnListAllGrades_Click(sender As
Object, e As EventArgs) Handles btnListAllGrades.Click
lstOutput.Items.Clear()
'clear list items
'check the file on
button click load if exist
'give the proper path of
the file
Dim fileReader As String
= "MacHomeDocumentsVisual Studio
2017VBStudentGradeFileStudentGradeFileinDebugGrades.txt" 'For
checking the file exist or not
MessageBox.Show(If(File.Exists(fileReader), "File exists.", "File
does not exist.")) 'Message give you file exist
If
System.IO.File.Exists(fileReader) = True Then
' read the file's lines into an ArrayList
objReader = New System.IO.StreamReader(fileReader)
Do While objReader.Peek() <> -1
'add the file item to arraylist and listbox
strFileLine = objReader.ReadLine()
arrLines.Add(strFileLine)
lstOutput.Items.Add(strFileLine)
Loop
objReader.Close() 'close reader
Else
MessageBox.Show(fileReader & " File does not exist") 'message
file doesnot exist
End If
End Sub
Private Sub btnDisplayStatistics_Click(sender
As Object, e As EventArgs) Handles btnDisplayStatistics.Click
lstOutput.Items.Clear()
'clear list items
'check the file on
button click load if exist
Dim fileReader As String
= "MacHomeDocumentsVisual Studio
2017VBStudentGradeFileStudentGradeFileinDebugGrades.txt" 'For
checking the file exist or not
MessageBox.Show(If(File.Exists(fileReader), "File exists.", "File
does not exist.")) 'Message give you file exist
If
System.IO.File.Exists(fileReader) = True Then
' read the file's lines into an ArrayList
objReader = New System.IO.StreamReader(fileReader)
Do While objReader.Peek() <> -1
'add the file item to arraylist and listbox
strFileLine = objReader.ReadLine()
arrLines.Add(strFileLine)
Loop
Dim sum As Integer = 0
Dim min As Integer = Integer.MaxValue, max As Integer =
Integer.MinValue, Value As Integer = 0
sum = arrLines(0)
For i As Integer = 1 To arrLines.Count - 1
Value = arrLines(i)
If Value < min Then
min = Value
End If
If Value > max Then
max = Value
End If
sum = sum + arrLines(i)
Next
objReader.Close() 'close reader
lstOutput.Items.Add("Maximum is: " & max)
lstOutput.Items.Add("Minimum is: " & min)
lstOutput.Items.Add("Average is: " & sum /
arrLines.Count)
Else
MessageBox.Show(fileReader & " File does not exist") 'message
file doesnot exist
End If
End Sub
Private Sub btnListAllwithGivenGrades_Click(sender As Object, e As EventArgs) Handles btnListAllwithGivenGrades.Click
End Sub
End Class
output:
I need help regarding my Visual Basic code ISC/ITE 285 Homework Due: Monday, January 28 by...
Java Programming Language Edit and modify from the given code Perform the exact same logic, except . . . The numeric ranges and corresponding letter grade will be stored in a file. Need error checking for: Being able to open the text file. The data makes sense: 1 text line of data would be 100 = A. Read in all of the numeric grades and letter grades and stored them into an array or arraylist. Then do the same logic....
I need help with my C coding homework. If possible can you
please comment to help me understand whats going on in the code.
Thanks in advance.
Create a C program (3 points): o At the top of the file include the following comments: Your name The purpose (core concept found below) of the program The date created o Create two int variables: Initialize each to different values. o Create three pointers: Point the first two pointers to the first...
Hi, I need help with my comp sci assignment. The parameters are listed below, but I am having trouble generating the number of occurrences of each word. Please use a standard library. Read in the clean text you generated in part 2 (start a new cpp file). Create a list of all the unique words found in the entire text file (use cleanedTextTest.txt for testing). Your list should be in the form of an array of structs, where each struct...
Hi I was hoping to get some help with my code for this problem. I don't know how to correctly read a txt file and the difference between using string and cstring. My code is at the bottom please help thanks. 1. Create the following “data.txt” file. Each record consists of customer's name and their balance: Maria Brown 2100.90 Jeffrey Jackson 200.20 Bernard Smith 223.10 Matthew Davenport 1630.20 Kimberly Macias 19100.90 Amber Daniels 2400.40 The records in the file will...
I NEED HELP with this. please create a UML diagram. I need a simple code to solve the problem. The ADT Bag is a group of items, much like what you might have with a bag of groceries. In a software development cycle, specification, design, implementation, test/debug, and documentation are typical activities. The details are provided in the rest of the document. ADT Bag Specification: (Note: You should not change the names of the operations in your program. This should...
I've done all questions except question 6. how do I do
this? please help.
code needs to be java
1. You need to be able to open and read the text files that have been provided for the project. Write a Java program that reads the driver.txt file and displays each data value for each line from the file to the screen in the following format: Licence Number: Licence Class: First Name: Last Name: Address: Suburb: Postcode: Demerit Points: Licence...
I need help figuring out how to code this in C++ in Visual Studio. Problem Statement: Open the rule document for the game LCR Rules Dice Game. Develop the code, use commenting to describe your code and practice debugging if you run into errors. Submit source code. Use the document to write rules for the user on how to play the game in a text file. Then, using the information from the resource articles, create a program that will read...
Please help. I need a very simple code. For a CS 1 class. Write a program in Java and run it in BlueJ according to the following specifications: The program reads a text file with student records (first name, last name and grade). Then it prompts the user to enter a command, executes the command and loops. The commands are the following: "printall" - prints all student records (first name, last name, grade). "firstname name" - prints all students with...
pls help java ASAP!!!!!!!
Topic String Tokenizer Static Methods Static Variables Primitive Arrays Description Enhance the last assignment by providing the following additional features: (The additional features are listed in bold below) Class Statistics In the class Statistics, create the following static methods (in addition to the instance methods already provided). • A public static method for computing sorted data. • A public static method for computing min value. • A public static method for computing max value. • A...