These exercises allow you to practice using variables and arithmetic in assignment statements.
Put your code in a new empty Java file named "ArithmeticExercises.java", and make sure to name the class ArithmeticExercises.
Start with a structure similar to VariableExercises.java, where you had a method called main() and then two other methods: part1() and part2().
Ask the user for their name. Then display their name to prove that you can recall it. Ask them for their age. Then display what their age would be five years from now. Then display what their age would be five years ago.
Hello. What is your name? Percy_Bysshe_Shelley Hi, Percy_Bysshe_Shelley! How old are you? 34 Did you know that in five years you will be 39 years old? And five years ago you were 29! Imagine that!
Make a simple numeric calculator. It should prompt the user for three numbers. Then add the numbers together and divide by 3. Display the result. Your program must support numbers with decimals and not just integers.
What is your first number? 1.1 What is your second number? 2.2 What is your third number? 5.5 ( 1.1 + 2.2 + 5.5 ) / 3 is... 2.9333333333