programming code

Ads

 
 

Share on Google+Share on Google+

Louis Brown
programming code
1 Answer(s)      8 years ago
Posted in : Java Beginners
Ads
View Answers

May 4, 2009 at 11:20 AM


Hi Friend,

Try the following code. I will really help you.

import java.io.*;
import java.util.*;
class TemperatureConverter {
public static void main(String[] args) throws Exception{
System.out.print("Enter the Temperature: ");
Scanner input=new Scanner(System.in);
double temp=input.nextDouble();
System.out.print("Enter unit F or C: ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String unit = br.readLine();
if((unit.equals("F"))||(unit.equals("f"))){
double c= (temp - 32) / 1.8;
System.out.println(c+" Celsius");
}
else if((unit.equals("C"))||(unit.equals("c"))){
double f=(temp*1.8+32);
System.out.println(f+" Fahrenheit");
input.close();
}
}
}

Thanks

Ads









Related Tutorials/Questions & Answers:
code for programming
code for programming   One fine day, Jack decided to complete his summer vacation assignment, to draw the view of the city which he gets from his..., Height = 11 and Breadth= 5. send me the code for this question ASAP.  
programming code - Java Beginners
programming code  program code for converting temperature from celsius to fahrenheit or fahrenheit to celsius using if-then-else to decide if celsius or fahrenheit is entered   Hi Friend, Try the following code. I
Advertisements
java programming code
java programming code  strong textHi I need the java code... are in inverted commas thank you. Blockquote HARDWARE ITEMS CODE DESCRIPTION UNIT...:" Apt 23" ADDRESS-2:" Building 8" ADDRESS-3: ""Winchester" POST CODE: "89763
Java Programming Code HELP
Java Programming Code HELP  Hi, sir/madam. I am new here and currently developing a program whereby it can read the Java source file...: String, attribute name = variable name) Below are my source code. Hope
game programming code - Swing AWT
game programming code  write a snake program using swings with step by step explanation?. please send me this source code to my mail id with step by step explanation
java programming code - Java Beginners
java programming code  I want to write a program that converts temperatures from celsius to fahrenheit and vice versa. It also converts kilometers to miles and vice versa using classes
java programming code - Java Beginners
java programming code  Design and write a Java application that takes... No digit corresponds to either Q or Z. For the two letters, your application should...;Hi Friend, Try the following code: import java.util.*; import
Programming
Programming  Given a number n, write a programming to determine its square root if it is possible, in the contraly case print an appropriate massege on the screen
programming
Java Constructor programming for single and double constructor  write a program which have no argument constructor ,single parameter constructor constructor,double parameter constor,and the now when we create a object
programming
programming  if we write a code for nearest no divisible by 5 example: given no divisible by 5 nearest no 12... for the waiting of ur answer ur friend`print("code sample
Programming
(); } } Is this code is beneficial for you. For further issues feel free to ask
java programming code to upload a dataset(text file) and show the values in graphically view
java programming code to upload a dataset(text file) and show the values in graphically view  how can be done upload a dataset(text file) and show the values in graphically view,,related to slam benchmarking java code
FTP Programming in Java tutorials with example code
FTP Programming in Java In this tutorial series of Java programming we are now continuing with the FTP Programming in Java. With the help of these tutorials... Programming in Java: What is FTP (File Transfer Protocol)? What is Anonymous FTP
Java File Programming
Java File Programming articles and example code In this section we will teach you about file programming in your Java applications. Java File Programming... program. Java programming language provides many API for easy file management. Java
r programming
r programming  Hi, How r programming is playing a big role in the Big Data time? These days companies are employing programmers with R Programming... in the market. Whey r programming is so important? Thanks   R
Programming with JSP
Programming with JSP  Write a program using jsp that accepts a course code as input and displays the course title the program to which it belongs
network programming
network programming   Tutorial for Network programming and administration
Programming with JSP
Programming with JSP  Who will post me the answer
Code
Code  code for connecting c lang to database
code
code    how to write this in java
code
code  code for android sample program
code for this is
code for this is  a b c d c b a a b c c b a a b b a a a code
code
code  please provide code for custom tags.by using currdate tag we need to get current date?please give me code
code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
Java Programming
Java Programming  Hi, What is Java Programming? How I can learn Java Programming in one month? Thanks
code
the correct code for a program.The output of the program is listed below...: {Block 5} ADDRESS-3: {San Juan} POST CODE:{6745} ENTER CODE (XX TO stop) CODE:{FF1} QUANTITY:{2} CODE:{TR4} QUANTITY:{1} CODE:XX INVOICE FOR YOUR ORDER Harry
code
code to create the RMI client on the local machine: import java.rmi.*; public... : "+e); } } } However, when the preceding code is executed it results... the correct code
code
code  i have four textboxes.whenever i click on up,down,left or down arrows then the cursor move to another textbox based on the key pressed.i want code for this in javascript
code
line of code to print the amount he should be paid as allowance
code
code  write a program to encrypt and decrypt the cipher text "adfgvx"   Hi Friend, Try the following code: import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import java.io.
Java Programming Examples
Java Programming Examples with explanations Java Programming is very... skill sets.In this section we are giving you the Java Programming examples..., programming frameworks and by Java programming packages/API.  Java