Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.net.*;
- import java.util.*;
- public class NewServer
- {
- static ServerSocket server;
- static Socket client;
- static PrintStream writer;
- static Scanner reader;
- static String username;
- static String password;
- static double balance;
- public static void main
- (String[] args)
- {
- try
- {
- server = new
- ServerSocket(9999);
- client = server.accept();
- writer = new PrintStream
- (client.getOutputStream());
- reader = new Scanner
- (client.getInputStream());
- getBalance();
- }
- catch (IOException IOex)
- {
- IOex.printStackTrace();
- }
- }
- public void getBalance()
- {
- username = reader.next();
- password = reader.next();
- if (password.equals(“guest”))
- balance = 100.00;
- else
- balance = 10.00;
- writer.println(balance);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement