-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperation2.java
More file actions
54 lines (48 loc) · 1.79 KB
/
Operation2.java
File metadata and controls
54 lines (48 loc) · 1.79 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.myfirstjava.program;
import java.net.*;
import java.io.*;
import java.util.*;
//Omer Mohammed Abbas om17102
//om17102@auis.edu.krd
public class Operation2 { //client
public static void main(String[] args) {
try {
Socket client = new Socket("127.0.0.1", 5151);
InputStream in = client.getInputStream();
OutputStream out = client.getOutputStream();
DataInputStream din = new DataInputStream(in);
DataOutputStream dout = new DataOutputStream(out);
do {
Scanner sc = new Scanner(System.in);
String txt;
System.out.println("Enter text: ");
txt = sc.nextLine();
dout.writeUTF(txt);
int count1,count2,count3,count4,count5;
count1=din.readInt();
System.out.println("Total no of vowels (a): " + count1);
count2= din.readInt();
System.out.println("Total no of vowels (e): " + count2);
count3= din.readInt();
System.out.println("Total no of vowels (i): " + count3);
count4 = din.readInt();
System.out.println("Total no of vowels (o): " + count4);
count5=din.readInt();
System.out.println("Total no of vowels (u): " + count5);
int numberofwords1,numberofwords2,numberofwords3,numberofwords4,numberofwords5;
numberofwords1= din.readInt();
System.out.println("number of words s1: " + numberofwords1);
numberofwords2 = din.readInt();
System.out.println("number of words s2: " + numberofwords2);
numberofwords3 = din.readInt();
System.out.println("number of words s3: " + numberofwords3);
numberofwords4 = din.readInt();
System.out.println("number of words s4: " + numberofwords4);
numberofwords5 = din.readInt();
System.out.println("number of words s5:" + numberofwords5);
}while(true);
}catch (Exception e) {
System.err.println(e.getMessage());
}
}
}