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.  
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
Advertisements
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
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
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
Java Programming
Java Programming  Hi, What is Java Programming? How I can learn Java Programming in one month? Thanks
Software Programming
in a programming language, perfecting code syntax and structure, analysis... there are various tasks in programming including debugging, testing, source code...Software Programming - What is Software Programming? Software programming
ajax programming
Ajax Programming What is Ajax Programming? Asynchronous JavaScript and XML... is based on the HTML, Java Script, CSS, and XML. Why Ajax Programming? When you.... Easy to learn and easy to write technology. Where to Start Ajax Programming
Ajax programming
Ajax programming  Hi, How I can start ajax programming easily? I... concept. What should be my starting point for Ajax programming? Thanks   Hi, If you have prior programming experience in any web development
Programming (general)
Programming (general)  I haven't yet started college/university but I'm interested in studying programming. I wondering if programming is difficult or confusing with all the codes you have to learn? Also how many languages would
code
code  code for android sample program
code
code    how to write this in java
Code
Code  code for connecting c lang to database
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
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
programming concept
programming concept  Write a program that allows the user to input a total dollar amount for an online shopping order and computes and outputs the shipping cost based on the following schedule
programming of foxpro
programming of foxpro  hello sir , sir i am use the foxpro . but i know about c . sir how can i learn fox pro . i know about something about foxpro
code
code  please provide code for custom tags.by using currdate tag we need to get current date?please give me code
socket programming question
socket programming question   can you respond to me the multiple clients chat application java code and a server that manages the clients using the socket programming in java
Tutorials   
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java

Ads

 
Advertisement null

Ads