HelloWorld
I first input an integer called “num” and put the value of 10 in it. “int” is a data type representing integer.
Addition
This program used the same technique with the previous HelloWorld one. But this time, I used “println()” instead of “printf()”. What is the difference between “print()”, “println()”, and “printf()”? See at Java Exercises
Moon Gravity
I used Scanner Class in the last three exercises. I first declare the Scanner class of input. Then I asked the user to input his/hers weight. After I got the input, I will put the input back to variable weight. Then after calculation, I output the users’ weight on moon. In the output sentence, I use “%.2f” which represents that my output is a decimal number and I want to keep two decimal spaces.
Scanner Pay
Sum2Num
Works Cited
“Displaying Text Using Printf() Method – Java Tutorial – Java With Us”. Javawithus.com. N.p., 2016. Web. 28 Nov. 2016.
“Displaying Text Using Printf() Method – Java Tutorial – Java With Us”. Javawithus.com. N.p., 2016. Web. 28 Nov. 2016.