# Allison Obourn
# CS 115, Autumn 2021
# Lecture 27

# This program prints an intro message describing what the program does,
# promts the user for three quiz scores for the first three quizzesand then
# prints out the final quiz percentage (which is always comprised of the
# highest score for each quiz). 

# NOTE: this program does not compute quiz scores the way they will be computed
#       in your grade. We will improve it later this week to compute your quiz
#       scores correctly

def main():
    intro()

    # totals the scores for all the quizzes
    counter = 0
    for i in range(1, 4):
        best_score = compute_one_quiz(i)
        counter = counter + best_score

    # if each quiz is out of 10 then the overall percent is the total points
    # over points possible (30) multiplied by 100 to make it a percent
    percent = counter / 30 * 100
    print("Your overall quiz percentage is: " + str(percent) + "%")


# prints out an introductory message explaining to the user what the program
# does. 
def intro():
    print("Enter your quiz scores (three for each quiz) and your")
    print("overall quiz percentage will be printed.")
    print()


# reads in three scores from the user, prompting them by stating the quiz
# number (the passed in value) and the number of the score. Returns the
# largest score of the three.
def compute_one_quiz(number):
    # read three scores from the user
    score1 = int(input("Quiz " + str(number) + " score 1? "))
    score2 = int(input("Quiz " + str(number) + " score 2? "))
    score3 = int(input("Quiz " + str(number) + " score 3? ")) 

    # NOTE: we had to catch the returned value in a variable so
    #       we could use it later in our code. 
    best_score = biggest(score1, score2, score3)
    
    print("Your final score for quiz", number, "is", best_score)
    print()
    return best_score


# takes three numbers as parameters and returns the biggest of the three
def biggest(score1, score2, score3):
    highest = score1
    
    if score2 > highest:
        highest = score2
    if score3 > highest:
        highest = score3

    return highest
    

        
main()
