Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You must use Arrays and Functions to do this. Your program will maintain the stu

ID: 3773095 • Letter: Y

Question

You must use Arrays and Functions to do this. Your program will maintain the student information such as names. Id's, and the examl score, exam2 score and examS score. Write a program with 5 arrays. Your program should display the following menu of choices to the user. It should perform the operations as suggested by the user and always come back to the menu and wait for the user to type in her his choice. Type P to populate the student information. Type U to update student Information Type D to display the student information. Type C to calculate the Grade. Type E to exit. If the user types P ask the user to enter the 10 student names, ID's, and score 1, score2 and score 3 for each of the student. Return to the menu. If the user types D then; Ask the user to enter the ID of the student. Search for the student in the ID array and display student name, ID, score 1, score2, scoreS. Return to the menu. If the user types U then; Ask the user to enter the ID of the student. Search for the student in the ID array and display student name, ID, scorel, score2, scoreS. Ask the user to enter the new scores for the student. Update the Scorel, Score2, and ScoreS arrays at that position. If the user types C then ask the user for the student ID. Find the student Id in the ID array. Calculate the average of the three scores for that student and display the grade of that student. The grade should be calculated based on the following criteria. If the average is between 90 and 100, then the grade is A. If the average is between SO and S9, then the grade should be B. If the average is between 70 and 79, then grade should be C. If the average is between 70 and 69 then the grade should be D. If the average is below 60, then the grade is F. Return to the main menu If the user types E. then: Terminate the main program. If the user tvoes anv other option Display the message "Invalid Choice. Try again" and go back and display the menu. You program must keep displaying the menu until the user types the option E, to exit the program. For this, you can use, while.. Wend| loop.

Explanation / Answer

Dim Names$(10)
Dim ID(10)
Dim score1(10)
Dim score2(10)
Dim score3(10)
do
    print "Please Enter P To Populate Student Information."
    print "Please Enter D To Display Student Information."
    print "Please Enter C To Calculate The Student's Grade."
    print "Please Enter E To Exit."
    input opt$
    select case
        case opt$ = "P" or opt$ = "p"
            if not(alreadyPopulated) then
                res = populatearray(10)
                alreadyPopulated = 1
            else
                print "Student Information Is Already Populated"
            end if
        case opt$ = "D" or opt$ = "d"
            print "Please Enter The Student Identification Card Number."
            input studsrchfor
            res = findstudinfo(studsrchfor)
            if (res <> -1) then
                print "The Student's Name Is ";Names$(res)
                print "The Student's ID Number Is ";ID(res)
                print "The Student's Score For The First Exam Is ";score1(res)
                print "The Student's Score For The Second Exam Is ";score2(res)
                print "The Student's Score For The Third Exam Is ";score3(res)
            end if
      case opt$ = "C" or opt$ = "c"
                  print "Please Enter The Student Identification Card Number."
                  input studsrchfor
                  res = findstudinfo(studsrchfor)
                  if (res <> -1) then
                      'the only line that should be changed
                      average = calcaverage(score1(res), score2(res), score3(res))
                      'rest are lines from your program
                      grade$ = calcgrade$(average)
                      print "Then Final Grade For ";Names$(res);" Is ";grade$;"."
            end if

        case opt$ = " "
            print "Invalid Choice. Please Try Again."
        case opt$ = "E" or opt$ = "e"
            "Valid choice"
        case else
            print "Invalid Choice. Please Try Again."
end select
loop until opt$ = "E" or opt$ = "e"
print "Thank You And Have A Nice Day."
end
function populatearray(size)
    for position = 1 to size
        print "Please Enter The Student's Name"
        input Names$(position)
        print "Please Enter The Student's ID Number."
        input ID(position)
        print "Please Enter The Student's Score For Exam 1."
        input score1(position)
        print "Please Enter The Student's Score For Exam 2."
        input score2(position)
        print "Please Enter The Student's Score For Exam 3."
        input score3(position)
    next
end function
function displayarray(size)
    for position = 1 to size
        print Names$(position)
        print studid(position)
        print score1(position)
        print score2(position)
        print score3(position)
    next
end function
function findstudinfo(studid)
     for position = 1 to 10
        if ID(position) = studid then
            exit for
        end if
     next
    if position = 11 then
        findstudinfo = -1
        print "Student Information Not Found."
    else
        findstudinfo = position
    end if
end function
function calcaverage(score1, score2, score3) ' function header
    avgscore = ((score1 + score2 + score3) / 3)
    calcaverage = avgscore   ' sends back the data
end function
function calcgrade$(scoreavg)   ' function header
    select case
        case (scoreavg>=90)
            finalgrade$="A"
        case ((scoreavg>=80) and (scoreavg<90))
            finalgrade$="B"
        case ((scoreavg>=70) and (scoreavg<80))
            finalgrade$="C"
        case ((scoreavg>=60) and (scoreavg<70))
            finalgrade$="D"
        case (scoreavg< 60)
            finalgrade$="F"
    end select
    calcgrade$=finalgrade$
end function
          
           

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote