File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 ("\n Day " + 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 ("\n Final 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+ }
You can’t perform that action at this time.
0 commit comments