John Kim 8 лет назад
Родитель
Сommit
0b418ee4d0
2 измененных файлов: 25 добавлений и 2 удалений
  1. 1
    2
      TriangleOne.java
  2. 24
    0
      UseTextIO.java

+ 1
- 2
TriangleOne.java Просмотреть файл

@@ -11,8 +11,7 @@ class TriangleOne
11 11
 
12 12
     public void display(int size)
13 13
     {
14
-        for(int i=0;i<size;i++)
15
-        {
14
+        for(int i=0;i<size;i++) {
16 15
             for(int j=0;j<=i;j++)
17 16
                 System.out.print("*");
18 17
             System.out.println();

+ 24
- 0
UseTextIO.java Просмотреть файл

@@ -0,0 +1,24 @@
1
+import java.io.*;
2
+/**
3
+ * Write a description of class UseTextIO here.
4
+ *
5
+ * @author (your name)
6
+ * @version (a version number or a date)
7
+ */
8
+public class UseTextIO
9
+{
10
+    private TextIO textIO;
11
+    
12
+    public UseTextIO() {
13
+        textIO = new TextIO();
14
+    }
15
+    
16
+    public void getInput() throws IOException{
17
+        BufferedReader br = TextIO.open(System.in);
18
+        TextIO.prompt("Hello");
19
+        TextIO.prompt("\n");
20
+        TextIO.prompt("Type an int: ");
21
+        int ask = TextIO.readInt(br);
22
+        TextIO.prompt("Your int is: " + ask + "\n");
23
+    }
24
+}