Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ out/

### VS Code ###
.vscode/


participants/fugitiva/ASCII_mirror/build
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ repositories {

dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation(project(":participants:fugitiva:ASCII_mirror")) // add dependency on participant_name/project_name
testImplementation("org.springframework.boot:spring-boot-starter-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

tasks.withType<Test> {
useJUnitPlatform()
}

16 changes: 16 additions & 0 deletions participants/fugitiva/ASCII_mirror/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// java-bootcamp/participants/fugitiva/ASCII_mirror/build.gradle.kts

plugins {
id("java")
}

group = "com.wcc.bootcamp.java"
version = "0.0.1-SNAPSHOT"

repositories {
mavenCentral()
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter:4.0.2") // Specify version explicitly
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ascii_mirror;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ASCii {
public static void main(String[] args) {
SpringApplication.run(ASCii.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package ascii_mirror.printingdata;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class ArrayReverser implements CommandLineRunner {

private static final Logger logger = LoggerFactory.getLogger(ArrayReverser.class);

@Override
public void run(String... args) {
int num[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
StringBuilder reversedOutput = new StringBuilder();

for (int i = num.length - 1; i >= 0; i--) {
reversedOutput.append(num[i]);
if (i > 0) {
reversedOutput.append(",");
}
}

logger.info("Reversed Array: {}", reversedOutput.toString());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package ascii_mirror.printingdata;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class LifeStageBaseonAge implements CommandLineRunner {

private static final Logger logger = LoggerFactory.getLogger(LifeStageBaseonAge.class);

//Your task is to write a complete Java program that takes in a single line with an integer between 0-100 (inclusive) as input. This integer represents a person's age. The program should then print a message that tells the person which life stage they are in based on the following conditions:
//If the person's age is less than 12 (inclusive), print 'Child'.
//If the age is between 13 and 17 (both inclusive), print 'Teenager'.
//If the age is between 18 and 59 (both inclusive), print 'Adult'.
//Lastly, if the person's age is 60 (inclusive) or above, print 'Senior Citizen'.
//Contrains:
//inputs 12, output: Child
//inputs 13, output: Teenager
@Override
public void run(String... args) {
int age = 13; // You can change this value to test with different ages; 13
if (age <= 12) {
logger.info("Child");
} else if (age >= 13 && age <= 17) {
logger.info("Teenager");
} else if (age >= 18 && age <= 59) {
logger.info("Adult");
} else if (age >= 60) {
logger.info("Senior Citizen");
} else {
logger.warn("Invalid age input: {}", age);
//System.out.println("invalid age");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package ascii_mirror.stranger;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class Stranger implements CommandLineRunner {

private static final Logger logger = LoggerFactory.getLogger(Stranger.class);

@Override
public void run(String... args) {


logger.info(" _______ ");
logger.info(" < hello >");
logger.info(" ------- ");
logger.info(" ^__^ / ");
logger.info(" _______/(oo) / ");
logger.info("/\\/( /(__) ");
logger.info(" | w----|| ");
logger.info(" || || ");
System.out.println();
}
}
10 changes: 10 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
rootProject.name = "java-bootcamp"
// myproject/settings.gradle.kts
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
//include projects participants
include("participants:fugitiva:ASCII_mirror")