Skip to content

Commit d9af670

Browse files
Add College Simulator game logic
This Java program simulates a college student's daily activities over three days, allowing choices that affect CGPA, health, and stress levels.
1 parent bc38d57 commit d9af670

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

College Simulator.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import java.util.Scanner;
2+
3+
public class CollegeSimulator {
4+
5+
public static void main(String[] args) {
6+
Scanner sc = new Scanner(System.in);
7+
8+
int cgpa = 7;
9+
int health = 70;
10+
int stress = 30;
11+
12+
for (int day = 1; day <= 3; day++) {
13+
System.out.println("\nDay " + day);
14+
System.out.println("1. Study");
15+
System.out.println("2. Sleep");
16+
System.out.println("3. Party");
17+
18+
System.out.print("Choose: ");
19+
int choice = sc.nextInt();
20+
21+
switch (choice) {
22+
case 1 -> { cgpa++; stress += 10; }
23+
case 2 -> { health += 10; stress -= 5; }
24+
case 3 -> { health -= 10; stress += 15; }
25+
}
26+
}
27+
28+
System.out.println("\nFinal Stats:");
29+
System.out.println("CGPA: " + cgpa);
30+
System.out.println("Health: " + health);
31+
System.out.println("Stress: " + stress);
32+
33+
if (cgpa >= 8 && health >= 60)
34+
System.out.println("🎉 Successful College Life!");
35+
else
36+
System.out.println("⚠️ Need Better Balance!");
37+
38+
sc.close();
39+
}
40+
}

0 commit comments

Comments
 (0)