Created
March 29, 2017 21:42
-
-
Save anonymous/baf6b9b3f182ead895939650329cc092 to your computer and use it in GitHub Desktop.
java oop part 1 helsinski
This file contains 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
public class Printing { | |
public static void printStars(int amount) { | |
// 39.1 | |
// you can print one star with the command | |
// System.out.print("*"); | |
// call this command amount times\ | |
int counter = 0; | |
while (counter < amount) { | |
System.out.print("*"); | |
counter++; | |
} | |
} | |
public static void printSquare(int sideSize) { | |
// 39.2 | |
} | |
public static void printRectangle(int width, int height) { | |
// 39.3 | |
} | |
public static void printTriangle(int size) { | |
// 39.4 | |
} | |
public static void main(String[] args) { | |
// Tests do not use main, yo can write code here freely! | |
// if you have problems with tests, please try out first | |
// here to see that the printout looks correct | |
printStars(5); | |
System.out.println("\n"); | |
printStars(3); | |
System.out.println("\n"); | |
printStars(9); | |
System.out.println("\n"); | |
// printing --- to separate the figures | |
printSquare(4); | |
System.out.println("\n---"); | |
printRectangle(5, 6); | |
System.out.println("\n---"); | |
printTriangle(3); | |
System.out.println("\n---"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment