public class PowerLevelCalculator {
public static void main(String[] args) {
int level = 10; // you can change this or take input from user
double basePower = 100;
double finalPower = basePower * Math.pow(1.2, level);
System.out.println("Level: " + level);
System.out.println("Base Power: " + basePower);
System.out.println("Final Power: " + finalPower);
}
}
Level: 10
Base Power: 100
Final Power: 619.17
Popcorn Hack #2
public class LootDropSimulator {
public static void main(String[] args) {
// Start the loot drop simulation
System.out.println("Loot Drop!");
// Generate a random number from 1–100 to determine item rarity
int rarityRoll = (int)(Math.random() * 100) + 1;
System.out.println("Rarity Roll: " + rarityRoll);
// Declare variables for rarity name and gold value
String rarity;
int goldValue;
// Check the rarity range based on the random roll
if (rarityRoll <= 60) {
// 1–60 → Common item
rarity = "COMMON";
// Generate gold between 10 and 30 (inclusive)
goldValue = (int)(Math.random() * (30 - 10 + 1)) + 10;
} else if (rarityRoll <= 85) {
rarity = "RARE";
goldValue = (int)(Math.random() * (70 - 31 + 1)) + 31;
} else {
rarity = "LEGENDARY";
goldValue = (int)(Math.random() * (100 - 71 + 1)) + 71;
}
// Display the results of the loot drop
System.out.println("You got: " + rarity + " item");
System.out.println("Gold Value: " + goldValue);
}
}