Test Corrections

  • Question 4:

    • I answered 2.33333333 instead of 2, because I didn't check to see what type of variable the num was. Because the variable type was Int, the result would be truncated to 2, not a double.
  • Question 15

    • I thought solution II worked, and it technically did, but I did not iterate the whole way through and assumed that the for loop had the correct length, but it throws and outOfBounds error because it iterates too many times.
  • Question 23

    • My answer would have worked if the condition for the loop was k > 1, not k > 0. I need to just read more carefully so that when I would out the iteration steps, I get the correct outputs.
  • Question 36

    • I missclicked, this question was really easy, I thought I chose the correct answer but I guess I didn't,

Reflection

Overall, I did really well. a 36/40 on the MCQ section and a good performance on the FRQ section would be a 5 on the ap exam. The part I really need to work on is maybe slowing down a bit and making sure I read the code given more closely to avoid making silly mistakes. All of the mistakes I made were not conceptual which is good, but to get a perfect score I need ot pay more attention on the instruction on the questions.

Unit 1 Homework - Code Below

import java.util.Scanner;

public class GradeCalculator {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Is final in a separate category: (true/false)");
        boolean check = input.nextBoolean();

        if(check){
            System.out.println("Current Grade:");
            double currentGrade = input.nextDouble();

            System.out.println("Desired Grade:");
            double desiredGrade = input.nextDouble();

            System.out.println("How much percent of your grade is the final:");
            double finalPercent = input.nextDouble();
            double finalGrade = ((desiredGrade-((1-finalPercent/100)*currentGrade))/(finalPercent/100));
            System.out.println("You need: " + finalGrade + "%");
            input.close();
        }

        else{
            System.out.print("Current grade? ");
            double currentGrade = input.nextDouble();
            System.out.println(currentGrade);

            System.out.print("Test category weight: ");
            int testCat = input.nextInt();
            System.out.println(testCat);

            System.out.print("total points in test category: ");
            int testCatPoints = input.nextInt();
            System.out.println(testCatPoints);

            System.out.print("final points: ");
            int finalPoints = input.nextInt();
            System.out.println(finalPoints);

            System.out.print("your grade in test category: ");
            double testCatGrade = input.nextDouble();
            System.out.println(testCatGrade);

            System.out.print("desired grade: ");
            double desiredGrade = input.nextDouble();
            System.out.println(desiredGrade);

            double finalScore = ((0.01*testCatGrade*finalPoints*testCat)-(finalPoints*currentGrade)+(finalPoints*desiredGrade)-(currentGrade*testCatPoints)+(testCatPoints*desiredGrade))/testCat;
            System.out.print("You need to get at least a " + String.format("%.2f", (finalScore/finalPoints)*100) + "% on you final to get a " + desiredGrade);
        }

    }
}
   
GradeCalculator.main(null);
Is final in a separate category: (true/false)
Current grade? 91.23
Test category weight: 80
total points in test category: 650
final points: 150
your grade in test category: 89.6
desired grade: 90.0
You need to get at least a 81.40% on you final to get a 90.0