Create an algorithm which will calculate and output your weighted test average (midterm1, midterm2 and final exam).
  1. The input stream will be three integer values representing the three scores.
  2. The output should be a line like this "The weighted test average is 98."
  • Create a literal container named 15 and store the value 15 in the container.
  • Create a literal container named 25 and store the value 25 in the container.
  • Create a literal container named "The weighted test average is "
    and store the value "The weighted test average is " in the container.
  • Create a literal container named "."
    and store the value "." in the container.
  •  
    Create a constant container named TEST1_WEIGHT that can hold integers
    and copy the value of the literal 15 into it.
    final int TEST1_WEIGHT = 15;
    Create a constant container named TEST2_WEIGHT that can hold integers
    and copy the value of the literal 15 into it.
    final int TEST2_WEIGHT = 15;
    Create a constant container named FINAL_WEIGHT that can hold integers
    and copy the value of the literal 25 into it.
    final int FINAL_WEIGHT = 25;
    Create a variable container named test1Score, that can hold integers. int test1Score;
    Create a variable container named test2Score, that can hold integers. int test2Score;
    Create a variable container named finalScore, that can hold integers. int finalScore;
    Create a variable container named tempWeightedScore, that can hold integers. int tempWeightedScore;
    Create a variable container named sumWeights, that can hold integers. int sumWeights;
    Create a variable container named sumWeightedScores, that can hold integers. int sumWeightedScores;
    Create a variable container named weightedAvg, that can hold rationals. float weightedAvg;
    Input an integer value and store that value in the container named test1Score. test1Score <- INPUT;
    Input an integer value and store that value in the container named test2Score. test2Score <- INPUT;
    Input an integer value and store that value in the container named finalScore. finalScore <- INPUT;
    Multiply the value in container TEST1_WEIGHT by the value in test1Score
    and write the result in sumWeightedScores.
    sumWeightedScores = TEST1_WEIGHT * test1Score;
    Multiply the value in container TEST2_WEIGHT by the value in test2Score
    and write the result in tempWeightedScore.
    tempWeightedScore = TEST2_WEIGHT * test2Score;
    Add the value in container sumWeightedScores to the value in tempWeightedScore
    and write the result in sumWeightedScores.
    sumWeightedScores = sumWeightedScores + tempWeightedScore;
    Multiply the value in container FINAL_WEIGHT by the value in finalScore
    and write the result in tempWeightedScore.
    tempWeightedScore = FINAL_WEIGHT * finalScore;
    Add the value in container sumWeightedScores to the value in tempWeightedScore
    and write the result in sumWeightedScores.
    sumWeightedScores = sumWeightedScores + tempWeightedScore;
    Add the values in containers TEST1_WEIGHT, TEST2_WEIGHT, and FINAL_WEIGHT
    and write the result in sumWeights.
    sumWeights = TEST1_WEIGHT +
       TEST2_WEIGHT + FINAL_WEIGHT;
    Divide sumWeightedScores by sumWeights and write the result into weightedAvg. weightedAvg = sumWeightedScores / sumWeights;
    Output the values in the following containers:
  • "The weighted test average is "
  • weightedAvg
  • "."
  • OUTPUT <- ("The weighted test average is " + weightedAvg + ".");