Question: Write (define) a public static method named countUp, that takes one int argument and returns no value. You can safely assume that the argument will
Write (define) a public static method named countUp, that takes one int argument and returns no value. You can safely assume that the argument will always be a positive integer. When this method is called, it should print a count from 1 up to (and including) the argument value.
Examples:
countUp(5) will print 1,2,3,4,5, countUp(6) will print 1,2,3,4,5,6, countUp(2) will print 1,2,
You may wish to write some additional code to test your method.
Helpful Hints:
Use a counter controlled While loop to count from 1 up to the argument value. Print out the current count at each iteration of the loop.
Java's for loop is also a good choice for this problem.
Remember that there is a significant difference between the print and println methods in Java.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
