Homework Help Question & Answers

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 will hold the same values as the string array but as data type of Double. At load time, use the ReDim statement to size the numeric array and a For loop to give it values (using the information that was loaded into the string array) Note: Using the step above, once the form becomes available, both arrays will have been created and populated Code the three button click events shown on the form below: Text Files List All Grades Traverse (read through) the numeric array and list all values in the listbox Display Statistics Display the highest grade, lowest grade, and average of all grades in the listbox List All with Given Grade - Ask the user to enter a letter grade (A, B, C D, or F). Traverse the numeric array and list all numeric values that would receive the given grade. At the end of the list, give a total count of the number of students who would receive the given grade List All Grades Display Statistics List All with Given Grade Notes: With this lab, you may use functions and subprocedures as you see fit. No data validation is required.

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 will hold the same values as the string array but as data type of Double. At load time, use the ReDim statement to size the numeric array and a For loop to give it values (using the information that was loaded into the string array) Note: Using the step above, once the form becomes available, both arrays will have been created and populated Code the three button click events shown on the form below: Text Files List All Grades Traverse (read through) the numeric array and list all values in the listbox Display Statistics Display the highest grade, lowest grade, and average of all grades in the listbox List All with Given Grade - Ask the user to enter a letter grade (A, B, C D, or F). Traverse the numeric array and list all numeric values that would receive the given grade. At the end of the list, give a total count of the number of students who would receive the given grade List All Grades Display Statistics List All with Given Grade Notes: With this lab, you may use functions and subprocedures as you see fit. No data validation is required.
0 0
Add a comment
Answer #1

Sign Up to Unlock the answer FREE

Already have an account? Log in

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:

Text Files List Al Grades 80 78 96 95 86 54 97 Display Statistics List All with Given Grades

Text Files Maximum is: 99 Minimum is: 54 Average is: 85.625 List All Grades Display Statistics List All with Given Grades

Add a comment
Know the answer?
Add Answer to:
I need help regarding my Visual Basic code ISC/ITE 285 Homework Due: Monday, January 28 by...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coin

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
  • Visual Basic 2010

    I am having trouble with the following visual basic problem:Create a form with a list box and a GO buttonHave two text files: STATES.TXT and RAINFALL.TXTWhen GO is clicked, read the STATES.TXT file into the STATES string array by expanding the array as each record is processed. Then using the length of the STATESarray, create the RAINFALL decimal array and using a loop read in the rainfall data again.Code a loop to add the data to the list box as...

  • I need help with my C coding homework. If possible can you please comment to help...

    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...

    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...

  • pls help java ASAP!!!!!!! Topic String Tokenizer Static Methods Static Variables Primitive Arrays Description Enhance the...

    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...

  • Please help. I need a very simple code. For a CS 1 class. Write a program...

    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...

  • Please Use C++ Language. Thank you. Please I need the actual code. Donot post psudocode!! ​And...

    Please Use C++ Language. Thank you. Please I need the actual code. Donot post psudocode!! ​And also I have codes but just donot work so make sure that it works. Requested files: CrosswordGenerator.cpp, CrosswordGenerator.h, CrosswordGenerator_test.cpp CrosswordGenerator - Write a program that helps to generate a crossword puzzle by organizing words that share letters.   For this assignment, you will write a program that forms the basis of a crossword puzzle generator. In order to create a crossword puzzle you need to...

  • I need help with this assignment. It's due Tuesday at 8 AM. Please follow the instructions thorou...

    I need help with this assignment. It's due Tuesday at 8 AM. Please follow the instructions thoroughly as to not use any advanced material we may not have gone over in class. The instructions let you know what all should be used. Thanks! Use only what you have learned in Chapters 1 - 7. Use of "advanced" material, material not in the text, or project does not follow the instructions, will result in a GRADE OF 0% for the project....

  • Hello I need help fixing my C++ code. I need to display in the console the...

    Hello I need help fixing my C++ code. I need to display in the console the information saved in the file as well have the content saved in the file output in a fixed position like the screenshot. Thanks. CODE #include<iostream> #include<fstream> #include<iomanip> using namespace std; //main function int main() {    //variable to store student id    int id;       //variables to store old gpa(ogpa), old course credits(occ), new course credits(ncc), current gpa(cur_gpa), cumulative gpa(cum_gpa)    float ogpa,...

  • Need code written for a java eclipse program that will follow the skeleton code. Exams and...

    Need code written for a java eclipse program that will follow the skeleton code. Exams and assignments are weighted You will design a Java grade calculator for this assignment. A user should be able to calculate her/his letter grade in COMS/MIS 207 by inputting their scores obtained on worksheets, assignments and exams into the program. A skeleton code named GradeCompute.java containing the main method and stubs for a few other methods, is provided to you. You must not modify/make changes...

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
Active Questions
ADVERTISEMENT