SWT301_-_SP_2024_-_PE1_1578.webp
F

SWT301_-_SP_2024_-_PE1_1578.webp

  • Media owner Fu841
  • Ngày thêm
2. import java.io.*;
3.
Zoom
4. class Checkstringsymmetry {
5.public static void main(String[] args) {
6.System.out.print("Please enter the character string you want to check:");
7.Scanner in-new Scanner(System.in);
8.String inputString in.nextLine();
9.int length inputString.length();
10.Stack stack new Stack();
11.
for (int i=0; i < inputString.length()1; 1++) {
12.stack.push(inputString.charAt(i));
13.}
14.String reverseString = "";
15.
16.while (!stack.isEmpty()) {
17.
reverseString stack.pop();
}
18.
19.if (inputString.equals(reverseString))
20.
System.out.println("This is a symmetric character string.")
21.else
22.System.out.println("This is not a symmetric character string.");
23.}
24. }
Question 2 (3 points): Assuming you are assigned to conduct the component test for the method

+ 107%
Close
Chưa có bình luận nào.

Thông tin

Category
SWT301
Thêm bởi
Fu841
Ngày thêm
Lượt xem
2,758
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
SWT301_-_SP_2024_-_PE1_1578.webp
File size
170.9 KB
Dimensions
1920px x 803px

Share this media

Back
Bên trên Bottom