/*
Operator precedence example.
Say you have a Tuesday/Thursday class and you can skip it if you have an A.
This code should tell you whether you can skip class or not...but there is an error.
Can you find the mistake?

Algorithm:
1. Declare a variable to hold your grade.
2. Assume today is Tuesday, so set a boolean to hold true for it's Tuesday, and false for it's Thursday.
3. Ask the user for their grade.
4. Read in the grade.
5. Set a boolean to hold whether you can skip class or not. 
You can skip class if it's Tuesday or it's Thursday (because those are the only days the class is held) and your grade is an A.
6. Print out the result.
*/

#include <stdio.h>
#include <stdbool.h>

int main(void){
	//Declare an integer to hold your grade.
	int grade = 1;

	//declare variables to hold whether today is Tuesday or Thursday. Assume it's Tuesday.
	bool isTuesday = false;
	bool isThursday = true;

	//ask the user for their grade
	printf("Enter your grade: ");
	//read in the grade
	scanf("%d",&grade);

	//you can skip class if it's Tuesday or it's Thursday, and your grade is an A.
	bool canSkip = grade > 89 && isTuesday || isThursday;

	//print out whether you can skip class or not
	printf("Can I skip class today? %d\n",canSkip);

	return 0;
}

