Home Answers Viewqa Java-Beginners programming code

 
 


Louis Brown
programming code
1 Answer(s)      4 years and a month ago
Posted in : Java Beginners

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









Related Pages:
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
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
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 as input a single letter and displays the corresponding digit on the telephone...;Hi Friend, Try the following code: import java.util.*; import
Programming
Java NotesProgramming Here are some tips on making programming student... of the basic elements of Extreme Programming (a much hyped, but good... and you will be rewarded. Eg, to get it to indent your code, match braces
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
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
java programming
java programming  Hi friends, i need a simple login form source code. in that program i have two labels,two text fields and two buttons namely ok and cancel buttons. how to write for that one using netbeans without database
java programming
java programming  How can be uesd in graphiclly view for user inter (x,y) cordinate and show the output shart point to end point. java code...); } } For the above code, you need jfreechart api
java programming
java programming  How can be uesd in graphiclly view for user inter (x,y) cordinate and show the output shart point to end point. java code...); } } For the above code, you need jfreechart api
java programming
java programming  How can be uesd in graphiclly view for user inter (x,y) cordinate and show the output shart point to end point. java code...); } } For the above code, you need jfreechart api
Java programming
but now base 16. Your code should work for any length input array, not just one
java programming
java programming  WAP to find the longest word from a user given string.   The given code finds the longest word from the string. import java.util.*; class LongestWord { Scanner input=new Scanner(System.in
java programming
java programming  WAP to accept 10 strings from the user and find out the string with maximum length and print the same.   Here is a code that accepts 10 strings from the string and stored into array and then find
Servlets Programming
Servlets Programming  Hi this is tanu, This is a code for knowing how many times a servlet has been accessed. but after executing this i am getting only 1 as output for many times of execution. I want to store the counter
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.4 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook..., abs, and ln. See the source code file for full details. The Expr class uses
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 Programming, Solution to Programming Exercise
Solution for Programming Exercise 12.4 THIS PAGE DISCUSSES ONE.... Some languages use predicates in generic programming. Java doesn't... as a standard part of the generic programming framework.) Discussion
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 6.4 THIS PAGE DISCUSSES ONE... the checkerboard. In that exercise, the code for drawing the board was in the paint() method of a plain Applet. However, the same code works in the paintComponent
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 3.5 THIS PAGE DISCUSSES ONE... a file that contains only the lines: <applet code="...; Call this file Checkerboard.html. This is the source code for a simple Web page
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 3.1 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... is not 1, that is, that either die1 is not 1 or die2 is not 1. In java code
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 7.6 THIS PAGE DISCUSSES ONE... a Timer. Add a Timer to the original source code, StopWatch.java, to display... this calculation and then sets the text of the label. The complete source code
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 4.1 THIS PAGE DISCUSSES ONE...), but str.charAt(i-1) doesn't exist if i is 0. Let's look at Java code... CODE ch = str.charAt( i ); if ( Character.isLetter(ch) &
Java Programming, Solution to Programming Exercise
Solution for Programming Exercise 12.6 THIS PAGE DISCUSSES ONE..., COS = 1, // Code numbers for each TAN = 2, ABS = 3... code) { // Constructor creates the standard function specified
java programming problem - JDBC
java programming problem  Hi, Request you to provide the source code in Java for the following programming problem : upload .csv file data into oracle database. please send the solution to raichallp@yahoo.in
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
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
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
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
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 5.2 THIS PAGE DISCUSSES ONE.... Exercise 5.2: A common programming task is computing statistics of a set... in the dataset. You can read the source code for this class in the file
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 3.2 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook.... The source code for that example is CountDivisors.java. You might need some hints
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 3.4 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... something. With this modification, the code becomes: for ( i = 0; i
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 4.2 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook...); This is the code that is used in the main() routine of the program to do
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 3.6 THIS PAGE DISCUSSES ONE...: <applet code="SlidingCheckerboard.class" width=160 height=160>... the first column starts at x = -40 instead of x = 0, the code would be almost
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 6.6 THIS PAGE DISCUSSES ONE... Section 6.5. You can start with the existing source code, from the file... this exercise, you only have to add a half-dozen lines to the source code
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 6.1 THIS PAGE DISCUSSES ONE...(). All the other programming (that is, rolling the dice and interacting.... It would be reasonable to put the code for rolling the dice
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 6.8 THIS PAGE DISCUSSES ONE... in Section 6.6. You can use the source code for that game, HighLowGUI.java... the BlackjackCanvas class. All the programming for the game is in this class
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 5.1 THIS PAGE DISCUSSES ONE... that guarantee, because the code that I write in the PairOfDice class is the only code that will ever affect the values of the variables. So, we will make
Java Programming, Solution to Programming Exercise
Solution for Programming Exercise 12.2 THIS PAGE DISCUSSES ONE.... Exceptions make it possible to organize the error-handling code... is legal. If not, throw an exception. This adds a lot of code, but the nice
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 8.1 THIS PAGE DISCUSSES ONE...? The source code for that program can be found in the file BirthdayProblemDemo.java.... to remember! In some programming languages, arrays are not automatically filled
Java Programming, Solution to Programming Exercise
Solution for Programming Exercise 12.3 THIS PAGE DISCUSSES ONE... as for HashMaps. Every Object has a hash code, so at least you don't have... that share the same has code. Initially, all the lists are empty (represented
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 8.4 THIS PAGE DISCUSSES ONE... find the source code for this class in the file MovingBall.java. A MovingBall... its size. See the source code for more information. For this exercise, you
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 6.7 THIS PAGE DISCUSSES ONE... as its direct superclass, rather than JApplet, so the source code begins..., as a matter of fact, I looked at the source code of SimpleAnimationApplet2 and saw
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 6.5 THIS PAGE DISCUSSES ONE... mouse and mouse motion events. The code for dragging a square is spread out... to the complete source code, shown below. By the way, if you wanted to stop the user from
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.2 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook...;); With these constants, the code for computing the next term in a 3N+1 sequence becomes
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 10.2 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook...', the character with code number zero. I should note that this is not built into streams

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.