Last active
December 27, 2015 02:09
-
-
Save henvic/7250635 to your computer and use it in GitHub Desktop.
Improvements in http://pastebin.com/mRYB79BW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package teste; | |
import java.util.Scanner; | |
public class Montanhas { | |
public static void main(String[] args) { | |
String pos; | |
boolean end = false; | |
int peaks; | |
int mountains; | |
Scanner input = new Scanner(System.in); | |
while (!end) { | |
System.out.print("Posição das montanhas (Vertical/Horizontal):"); | |
pos = input.nextLine(); | |
System.out.print("Quantidade de montanhas:"); | |
peaks = input.nextInt(); | |
input.nextLine(); | |
if (pos.equals("Vertical")) { | |
for (mountains = 0; mountains <= peaks - 1; mountains = mountains + 1) { | |
System.out.println(" x \n xxx \nxxxxx"); | |
} | |
} | |
if (pos.equals("Horizontal")) { | |
for (mountains = 0; mountains <= peaks; mountains = mountains + 1) { | |
System.out.println("x \nxx \nx"); | |
} | |
} | |
System.out.println("Você quer continuar?"); | |
end = !input.nextLine().equals("sim"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment