Question: (JavaScript) Im looking to add to this code to do the following: Add a break command, asking if they want to stop. And if so,

(JavaScript)

Im looking to add to this code to do the following:

Add a break command, asking if they want to stop. And if so, surface.

Every time they do deeper, add a printout for a random fish. (At least 3 types)

Here is the current code:

import java.util.Scanner;

public static void main(String[] args) { Scanner inputReader = new Scanner(System.in); System.out.println("Already, get those flippers and wetsuit on - we're going diving!"); System.out.println("Here we goooOOOooo.....! *SPLASH*"); int depthDivedInFt = 0; while(depthDivedInFt < 36200) { System.out.println("So far, we've swam " + depthDivedInFt + " feet"); if (depthDivedInFt >= 20000) { System.out.println("Uhhh, I think I see a kraken, guys..."); System.out.println("TIME TO GO!"); break; } depthDivedInFt += 1000; } System.out.println(" "); System.out.println("We ended up swimming " + depthDivedInFt + " feet down."); System.out.println("I bet we can do better next time!"); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!