P13 Hollow diamond star pattern using oop in java#java#shorts#javapattern#javaprogramming#javaoop

preview_player
Показать описание
Video = P13(Jai Hind)

This is the series of java pattern using oop(Object Oriented Programming)

Please subscribe for more contents.

Playlist of pattern using oop =

App name = Jvdroid

App installation video =

Device use to making this video

Phone name = oppo A15.
External keyboard = Zebronics.
External mouse = Zebronics.
Editor = KineMaster.

#javaprogrraming
#javapattern
#codingwithphone
#javaoop
#shorts
#codingwallah
#codingstatusvideo
Рекомендации по теме
Комментарии
Автор

Source code

interface layout {
void userInpute();
void setX();
void condition(boolean y);
void logic();
}
class pattern implements layout {
public int number;
public int x;

public void userInpute() {
java.util.Scanner sc = new java.util.Scanner(System.in);
System.out.println("Enter a number");
number = sc.nextInt();
}

public void setX() {
x = number / 2 + 1;
}

public void condition(boolean y) {
if (y) {
System.out.print("*");
} else {
System.out.print(" ");
}
}

public void logic() {
for (int i = 1; i <= number ; i++) {
for (int j = 1; j <= number; j++) {
condition(j == x || j == number - x + 1);
}
if (i <= number / 2) {
x--;
} else {
x++;
}
System.out.println();
}
}
}
public class Main {
public static void main(String[] args) {
pattern p = new pattern();

p.userInpute();
p.setX();
p.logic();
}
}

sahil_bhaiya
visit shbcf.ru