🎯 Objective
Instructions:
Create a new Java file named
Countdown.java
. This is the class where you'll implement the countdown logic.In the
Countdown
class, define three methods:doWhileCountdown()
,whileCountdown()
, andforCountdown()
. Each method will implement the countdown using a different loop structure.Implement the
doWhileCountdown()
method using ado-while
loop,whileCountdown()
method using awhile
loop, andforCountdown()
method using afor
loop. Each method will count down from 10 to 1 and then print "Blastoff".Now, create another Java file named
CountdownApp.java
. This will contain yourmain
method, and you'll use it to create an instance of theCountdown
class and call each of its methods.
...
Code Block |
---|
10 9 8 7 6 5 4 3 2 1 Blastoff! 10 9 8 7 6 5 4 3 2 1 Blastoff! 10 9 8 7 6 5 4 3 2 1 Blastoff! |
🚚 Deliverables
Upload the following files in a zip folder that you have created:
...