Skip to content

Instantly share code, notes, and snippets.

Created March 29, 2017 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/baf6b9b3f182ead895939650329cc092 to your computer and use it in GitHub Desktop.
Save anonymous/baf6b9b3f182ead895939650329cc092 to your computer and use it in GitHub Desktop.
java oop part 1 helsinski
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