Welcome to Dream.In.Code
Become a Java Expert!

Join 150,369 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,780 people online right now. Registration is fast and FREE... Join Now!




how to add a math formula in a server/client application

 
Reply to this topicStart new topic

how to add a math formula in a server/client application

michael351
3 Feb, 2008 - 02:20 PM
Post #1

New D.I.C Head
*

Joined: 29 Jan, 2008
Posts: 12

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 PB

This post has been edited by PennyBoki: 3 Feb, 2008 - 07:54 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 02:13PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month