Here is a recap of what we learned in class today:
-Literals and data types
Literals are numeric values that are used to compute. Arithmetic equations include variables, literals, and operators.
If you mix different types of data, all "lower" types will be automatically promoted to the "higher" type in the operations.
For example, if you divide an integer by a double, the result would be a double.
-Casting
If you want to specify the types of a variable or expression, you can use explicit type casting.
For example, (double)1729/10 = 172.0, but ((double)1729)/10 = 172.9.
-Assignment
In coding, the equal sign "=" has a different meaning. Instead of meaning "equals", it means assigning the right side of the equation to the left or "assignment."
For example, x=x+1 would mean adding 1 to x then assigning the value back to x.
There are also shortcut operators for this purpose like "++" and "--."
Link to homework solution: https://replit.com/@liizz/929-HW-Solution#Main.java