When coming up with what functionalities my tip calculator would provide the user, I decided to reference the tip function on a debt machine. Originally, I wanted the user to choose between an percent tip and specified amount. It was only after looking up how to pull data from radio buttons into Java, that I realized that if the user wanted to tip a specified amount, they would not need a calculator. Despite being a bit of a waste of time, taking out that function did work in my favour.
Another problem I encountered was trying to implement an animation into my calculator.
In the last line of code above, I originally had “spin” instead of “rotate” when spin was actually the animation name. Because spin is not a class, Java could not find and execute the animation.
I also originally forgot to integrate the “onclick=’start()'” into the button, meaning that the button did not activate the animation function.
The final problem I encountered was a quick fix. I wasn’t sure how to round the answer to 2 decimal places. I ended up finding the answer on the stack Overflow forum. To solve the problem, I had to use the calculation shown above. “Math.round” rounds the answer to the nearest decimal place, so I had to multiply the answer my 100 in the round function and divided it again after.
I decided to stick with a minimalistic design with a simple colour pallet and animation.