This commit is contained in:
2026-10-12 23:00:37 -04:00
commit 144e286b53
14 changed files with 328 additions and 0 deletions
@@ -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);
}
}
+17
View File
@@ -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);
}
}
}
+27
View File
@@ -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);
}
}
+19
View File
@@ -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();
}
}
+19
View File
@@ -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();
}
}