Init
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
.kotlin
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
Generated
+10
@@ -0,0 +1,10 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_25" default="true" project-jdk-name="ms-25" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>ics3.other</groupId>
|
||||
<artifactId>ics3</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>25</maven.compiler.source>
|
||||
<maven.compiler.target>25</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,56 @@
|
||||
package ics3.other;
|
||||
|
||||
public class CombatEngine {
|
||||
|
||||
public static void formatHeader(String name) {
|
||||
System.out.println("=== HERO: [" + name + "] ===");
|
||||
}
|
||||
|
||||
public static void formatHeader(String name, String title) {
|
||||
System.out.println("=== HERO: [" + name + "] the [" + title + "] ===");
|
||||
}
|
||||
|
||||
public static int computeDamage(int baseAttack) {
|
||||
return baseAttack;
|
||||
}
|
||||
|
||||
public static int computeDamage(int baseAttack, double critMultiplier) {
|
||||
return (int)(baseAttack * critMultiplier);
|
||||
}
|
||||
|
||||
public static int computeDamage(int baseAttack, double critMultiplier, int defense) {
|
||||
return (int)Math.abs((baseAttack * critMultiplier) - defense);
|
||||
}
|
||||
|
||||
public static int heal(int currentHp, int healAmount) {
|
||||
return currentHp + healAmount;
|
||||
}
|
||||
|
||||
public static int heal(int currentHp, int healAmount, int maxHp) {
|
||||
return Math.min(currentHp + healAmount, maxHp);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("=== COMBAT ENGINE TEST LOG ===\n");
|
||||
|
||||
formatHeader("Aria");
|
||||
formatHeader("Aria", "Dragon Slayer");
|
||||
System.out.println();
|
||||
|
||||
int dmg1 = computeDamage(25);
|
||||
int dmg2 = computeDamage(25, 2.0);
|
||||
int dmg3 = computeDamage(25, 2.0, 10);
|
||||
|
||||
System.out.println("Basic Damage: " + dmg1);
|
||||
System.out.println("Critical Damage: " + dmg2);
|
||||
System.out.println("Armored Damage: "+ dmg3);
|
||||
System.out.println();
|
||||
|
||||
int hp1 = heal(40,30);
|
||||
int hp2 = heal(80,30,100);
|
||||
|
||||
System.out.println("HP after basic heal: " + hp1);
|
||||
System.out.println("HP after capped heal: " + hp2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package ics3.other;
|
||||
|
||||
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||
public class Main {
|
||||
static void main() {
|
||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
|
||||
// to see how IntelliJ IDEA suggests fixing it.
|
||||
IO.println(String.format("Hello and welcome!"));
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
||||
IO.println("i = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package ics3.other;
|
||||
|
||||
public class MethodLab {
|
||||
public static void greetPlayer(String name) {
|
||||
System.out.println("Welcome to the arena, " + name + "!");
|
||||
}
|
||||
|
||||
public static void greetPlayer(String name, int level) {
|
||||
System.out.println("Welcome, " + name + " [Level " + level + "]!");
|
||||
}
|
||||
|
||||
public static int calcDamage(int attackPower) {
|
||||
return attackPower;
|
||||
}
|
||||
|
||||
public static int calcDamage(int attackPower, double critMultiplier) {
|
||||
return (int) (attackPower * critMultiplier);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
greetPlayer("Alex");
|
||||
greetPlayer("Alex", 15);
|
||||
calcDamage(20);
|
||||
calcDamage(20, 1.5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package ics3.other;
|
||||
|
||||
public class MyOutput {
|
||||
MyOutput() {
|
||||
|
||||
}
|
||||
|
||||
public void display() {
|
||||
System.out.print("No Spaces");
|
||||
System.out.print("\t\t\t");
|
||||
System.out.println("Three tabs");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
MyOutput m = new MyOutput();
|
||||
m.display();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package ics3.other;
|
||||
|
||||
public class MyText {
|
||||
|
||||
public static void output() {
|
||||
System.out.println("txt: "+ 76);
|
||||
System.out.println("txt: "+ 76.2);
|
||||
|
||||
System.out.println("txt: "+ 76 + 20);
|
||||
|
||||
// System.out.printf("This number is %d", 10);
|
||||
|
||||
System.out.printf("%-15d %d %n", 10, 20);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
output();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package ics3.other;
|
||||
|
||||
//customers
|
||||
//Kuba
|
||||
//store prints
|
||||
|
||||
public class NumericOutput {
|
||||
NumericOutput() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
System.out.printf("%77s%n", "-----------------------------------------------------");
|
||||
System.out.printf("%60s%n", "The One Item Shop");
|
||||
System.out.printf("%32s %17s %15s %10s%n", "Customer", "# of items", "Price", "Total");
|
||||
}
|
||||
|
||||
public void displayCustomers() {
|
||||
System.out.printf("%30s %15d %17.2f %11.2f%n", "Janet", 5, 12.99, 5*12.99);
|
||||
System.out.printf("%30s %15d %17.2f %11.2f%n", "Paul", 7, 6.45, 7*6.45);
|
||||
System.out.printf("%30s %15d %17.2f %11.2f%n", "Sedol", 15, 2.89, 15*2.89);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
NumericOutput d = new NumericOutput();
|
||||
d.displayCustomers();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package ics3.other;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ReceiptCalculatorr {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner scan = new Scanner(System.in);
|
||||
System.out.print("Enter name: ");
|
||||
String name = scan.nextLine();
|
||||
System.out.print("Enter number of meal items: ");
|
||||
int itemCount = scan.nextInt();
|
||||
System.out.print("Enter meal subtotal: ");
|
||||
double subtotal = scan.nextDouble();
|
||||
|
||||
double tax = subtotal * 0.08;
|
||||
double tip = subtotal * 0.15;
|
||||
double grandTotal = subtotal+tax+tip;
|
||||
|
||||
System.out.println("----- RECEIPT FOR " + name + " -----");
|
||||
System.out.println("Items purchased: " + itemCount);
|
||||
System.out.println("Subtotal: $" + subtotal);
|
||||
System.out.println("Tax: $" + tax);
|
||||
System.out.println("Tip: $" + tip);
|
||||
System.out.println("---------------------------");
|
||||
System.out.println("Grand total: $" + grandTotal);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package ics3.other;
|
||||
|
||||
//Draw
|
||||
//Kuba
|
||||
//do triangle + square
|
||||
|
||||
public class TriangleOutput {
|
||||
public static void drawTriangle() {
|
||||
System.out.printf("%70s%n", "T");
|
||||
System.out.printf("%71s%n", "TR");
|
||||
System.out.printf("%72s%n", "TRI");
|
||||
System.out.printf("%73s%n", "TRIA");
|
||||
System.out.printf("%74s%n", "TRIAN");
|
||||
System.out.printf("%75s%n", "TRIANG");
|
||||
System.out.printf("%76s%n", "TRIANGL");
|
||||
System.out.printf("%77s%n", "TRIANGLE");
|
||||
|
||||
}
|
||||
|
||||
public static void drawSquare() {
|
||||
System.out.printf("%75s%n", "SQUARE");
|
||||
System.out.printf("%70s \t %s%n", "Q", "R");
|
||||
System.out.printf("%70s \t %s%n", "U", "A");
|
||||
System.out.printf("%70s \t %s%n", "A", "U");
|
||||
System.out.printf("%70s \t %s%n ", "R", "Q");
|
||||
System.out.printf("%75s%n", "ERAUQS");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
drawTriangle();
|
||||
System.out.println();
|
||||
drawSquare();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user