-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFirstNameAndNumStudent.java
More file actions
32 lines (29 loc) · 1.07 KB
/
Copy pathFirstNameAndNumStudent.java
File metadata and controls
32 lines (29 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.io.PrintWriter;
import java.util.Scanner;
public class FirstNameAndNumStudent {
public static void main(String[] args) {
String fileName = "stName.dat";
CreateFile(fileName);
}
public static void CreateFile(String fileName) {
try {
Scanner in = new Scanner(System.in);
PrintWriter outFile = new PrintWriter(fileName);
String S;
System.out.print("Enter Name & Family: ");
S = in.next();
while (!S.equals("stop")) {
outFile.print(S + " ");
S = in.next(); // ورودی بعدی را بخوانید
}
outFile.close();
System.out.print("Enter Number of Students: ");
int n = in.nextInt();
for (int i = 1; i <= n; i++) {
// پیاده سازی منطق برای مدیریت داده های دانش آموز و نوشتن در فایل
}
} catch (Exception e) {
System.out.println("An error occurred: " + e.getMessage());
}
}
}