🔒 Closed Good day, papa tulong lang po sana.

Status
Not open for further replies.

XIU

Elite
Good day, papa tulong lang po sana if pano ma fix to, salamat mga master

package act4; import java.util.Scanner; import java.util.Stack; public class Act4{ public static void main (String[] args) { Stack<Integer> stack = new Stack<Integer>(); Scanner scan = new Scanner(System.in); int size = 0; System.out.System.out.println("Minimum = 20"); while (size=0) System.out.println("Enter how many number stack:"); int num = scan.nextlnt(); if(!(num >=10 && num <=20)){ continue; } size = num; } System.out.println("Enter the numbers:"); for (int x= 0; x <size; x++){ stack.push(scan.nextlnt()); } System.out.println("Stack:" + stack); System.out.println("Stack:" + peek); System.out.println("Stack:" + size); } }


H1.png
h2.png
 
Line 10: na doble yung System.out
Line 11: walang curly braces while(){} then mali yung condition hindi mo naman kinocompare, iniitialize mo gawin mong double equals ==
Line 25: wala ka naman variable na peek
 
Line 10: na doble yung System.out
Line 11: walang curly braces while(){} then mali yung condition hindi mo naman kinocompare, iniitialize mo gawin mong double equals ==
Line 25: wala ka naman variable na peek
Sharp eye ka lodicakes a HAHAHA di ko napansin ung double system.out
 
  • Love
Reactions: XIU
Hindi ko masyadong maintindihan, gawa ng wala naman talagang itinuro sa amin haha. Baka pwede naman mag pa tulong mapa run to aaaaaccckkkk

package act4;
import java.util.Scanner;
import java.util.Stack;

public class Act4{
public static void main (String[] args) {
Stack<Integer> stack = new Stack<Integer>();
Scanner scan = new Scanner(System.in);
int size = 0;
System.out.println("Minimum = 20");
while (size ==){}
System.out.println("Enter how many number stack:");
int num = scan.nextlnt();

if(!(num >=10 && num <=20)){
continue;
}
size = num;
}
System.out.println("Enter the numbers:");
for (int x= 0; x <size; x++){
stack.push(scan.nextInt());
}
System.out.println("Stack:" + stack);
System.out.println("Stack:" + peek);
System.out.println("Stack:" + size);

}
}
 
Status
Not open for further replies.

About this Thread

  • 11
    Replies
  • 775
    Views
  • 4
    Participants
Last reply from:
XIU

Trending Topics

Online now

Members online
1,213
Guests online
1,184
Total visitors
2,397

Forum statistics

Threads
2,272,112
Posts
28,940,270
Members
1,237,996
Latest member
tachyon96
Back
Top