Hi guys,
does anyone know where exactly i can add the formula in my client, when it receives the results from the server.
My client receives a tempereture from the server, and i want the formula to convert it to celsius from fahrenheit,
this is my client at the moment.
CODE
import java.io.*;
import java.net.*;
import javax.swing.JOptionPane;
//class Socket is in java.net
public class TemperatureClient
{
public void go()
{
try
{
Socket s = new Socket("127.0.0.1",4242);
InputStreamReader streamReader = new InputStreamReader(s.getInputStream());
BufferedReader reader = new BufferedReader(streamReader);
String tempStr = reader.readLine();
System.out.println("Receiving following message from Server...");
System.out.println("The fahrenheit temperature is "+(tempStr));
//System.out.println("Celsius temperature is "+(tempStr+ 6*2)+("Formula Comes In hear, learn how"));
reader.close();
}
catch(IOException ex)
{
ex.printStackTrace();
}
}
public static void main(String args[])
{
TemperatureClient client = new TemperatureClient();
client.go();
}
}
~edit: code tags added PBThis post has been edited by PennyBoki: 3 Feb, 2008 - 07:54 PM