// Popcorn Hack #1
int playerScore = 1000;
int playerHealth = 100;
int enemiesDefeated = 0;
// Player defeats an enemy worth 250 points
playerScore += 250;
// Player takes 15 damage
playerHealth -= 15;
// Enemy count goes up
enemiesDefeated++;
// Boss battle: double the current score!
playerScore *= 2;
// Healing potion restores health to 80% of current
playerHealth *= 4;
playerHealth /= 5; // 4/5 = 0.8, integer math keeps it whole number
public class ScoreUpdater {
public static void main(String[] args) {
int score = 100;
System.out.println("Starting score: " + score);
// Deduct points for a wrong answer
score -= 25;
System.out.println("After wrong answer (-=): " + score);
// Double the score with a power-up
score *= 2;
System.out.println("After power-up (*=): " + score);
// Find remainder after dividing by 7
score %= 7;
System.out.println("After dividing by 7 (%=): " + score);
}
}
public class InfluencerSimulator {
public static void main(String[] args) {
// Starting stats for the influencer
int followers = 500;
int posts = 10;
int engagement = 200;
double sponsorshipEarnings = 150.0;
System.out.println("📱 Social Media Influencer Simulator");
System.out.println("------------------------------------");
System.out.println("Starting followers: " + followers);
System.out.println("Starting engagement: " + engagement);
System.out.println("Starting sponsorship earnings: $" + sponsorshipEarnings);
System.out.println();
followers += 1200;
System.out.println("After viral post, followers += 1200 → Followers: " + followers);
followers -= 75;
System.out.println("After controversy, followers -= 75 → Followers: " + followers);
engagement *= 2;
System.out.println("After trending hashtag, engagement *= 2 → Engagement: " + engagement);
engagement /= posts;
System.out.println("Average engagement per post (engagement /= posts): " + engagement);
sponsorshipEarnings += 250.75;
System.out.println("After new sponsorship deal, earnings += 250.75 → $" + sponsorshipEarnings);
int position = followers % 100;
System.out.println("Leaderboard position (followers % 100): " + position);
}
}