Telegram Group & Telegram Channel
23. Christmas tree.

class ChristmasTree
{
public static final int segments = 4;
public static final int height = 4;

public static void main(String[] args)
{
makeTree();
}

public static void makeTree()
{
int maxStars = 2 * height + 2 * segments - 3;
String maxStr = "";
for (int l = 0; l < maxStars; l++)
{
maxStr += " ";
}

for (int i = 1; i <= segments; i++)
{
for (int line = 1; line <= height; line++)
{
String starStr = "";
for (int j = 1; j <= 2 * line + 2 * i - 3; j++)
{
starStr += "*";
}

for (int space = 0; space <= maxStars - (height + line + i); space++)
{
starStr = " " + starStr;
}
System.out.println(starStr);
}
}

for (int i = 0; i <= maxStars / 2; i++)
{
System.out.print(" ");
}

System.out.println(" " + "*" + " ");

for (int i = 0; i <= maxStars / 2; i++)
{
System.out.print(" ");
}

System.out.println(" " + "*" + " ");

for (int i = 0; i <= maxStars / 2 - 3; i++)
{
System.out.print(" ");
}

System.out.println(" " + "*******");
}
}

@java_Codings



tg-me.com/java_codings/34
Create:
Last Update:

23. Christmas tree.

class ChristmasTree
{
public static final int segments = 4;
public static final int height = 4;

public static void main(String[] args)
{
makeTree();
}

public static void makeTree()
{
int maxStars = 2 * height + 2 * segments - 3;
String maxStr = "";
for (int l = 0; l < maxStars; l++)
{
maxStr += " ";
}

for (int i = 1; i <= segments; i++)
{
for (int line = 1; line <= height; line++)
{
String starStr = "";
for (int j = 1; j <= 2 * line + 2 * i - 3; j++)
{
starStr += "*";
}

for (int space = 0; space <= maxStars - (height + line + i); space++)
{
starStr = " " + starStr;
}
System.out.println(starStr);
}
}

for (int i = 0; i <= maxStars / 2; i++)
{
System.out.print(" ");
}

System.out.println(" " + "*" + " ");

for (int i = 0; i <= maxStars / 2; i++)
{
System.out.print(" ");
}

System.out.println(" " + "*" + " ");

for (int i = 0; i <= maxStars / 2 - 3; i++)
{
System.out.print(" ");
}

System.out.println(" " + "*******");
}
}

@java_Codings

BY Advance Java πŸ‘¨β€πŸ’»


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/java_codings/34

View MORE
Open in Telegram


Advance Java ‍ Telegram | DID YOU KNOW?

Date: |

For some time, Mr. Durov and a few dozen staffers had no fixed headquarters, but rather traveled the world, setting up shop in one city after another, he told the Journal in 2016. The company now has its operational base in Dubai, though it says it doesn’t keep servers there.Mr. Durov maintains a yearslong friendship from his VK days with actor and tech investor Jared Leto, with whom he shares an ascetic lifestyle that eschews meat and alcohol.

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

Advance Java ‍ from sg


Telegram Advance Java πŸ‘¨β€πŸ’»
FROM USA