Temperature conversion program java




















Java regionMatches Method - String Comparison. Java compareTo method. Modifying a String. Java String substring method - substring In Java. Additional String Methods in Java. Java StringBuffer. Java StringBuffer length And capacity Methods. Java append Method In StringBuffer. Java substring. StringBuilder Class In Java.

Conclusion Of Strings In Java. Exploring java. Primitive Type Wrappers. Java Number Class. Converting Numbers to and from Strings In Java. Java Character Class. Java Boolean Class. Java Void Class. Java Process Class. Java Runtime Class - java. Java ProcessBuilder. System Class arraycopy Method In Java. Java Environment Properties. Java ClassLoader. Java Math Class - java. Java Package Class.

Java Enumeration. Java Comparable Interface with Example. Conclusion Exploring java. Collections Framework. Java Collections Overview. Collection Interface. Java List Interface. Set Interface In Java. Java SortedSet Interface. Java NavigableSet Interface. Collection Classes. Java ArrayList. Java LinkedList. HashSet Class In Java. Java LinkedHashSet. Java ArrayDeque Class. Java EnumSet. Java Iterator. List Iterator In Java. Map Interfaces.

Java SortedMap Interface. Java NavigableMap. Java Map. Entry Interface. Map Classes. Java HashMap Implementation. TreeMap In Java - java. Java WeakHashMap Class. Java IdentityHashMap. Java EnumMap. Java Comparators. Collection Algorithms. Java Collection Algorithms. Java Read-only Collections And Algorithms. Java Singleton.

Java nCopies Collections - Collections. Legacy Classes and Interfaces. Java Vector. Stack In Java - java. Stack Class. Java Dictionary Class - java. Java Hashtable. Java Properties Class - java. Properties Class. Collection Framework In Java.

More Utility Classes. StringTokenizer In Java. Java BitSet. Java Date Class. Calendar In Java - java. Calendar Class. Java GregorianCalendar. Java TimeZone Class.

Java SimpleTimeZone. Locale Class In Java. Java Random Class - java. Random Package. Java Observable.

Java Currency Class. But you're presenting your code here to get advice how to improve your programming skills, so here are a few remarks. Take them as a hint where to go from here, as soon as you feel ready for the "next level".

Your main method contains both aspects in one piece of code, even within the same line e. Make it a habit to separate tasks that can be named individually into methods of their own:.

With separate methods, it will be easier to later change your program to e. Your current program always forces the user to do exactly one C-to-F and then one F-to-C conversion. This will rarely both be needed at the same time. I'd either ask the user at the beginning for the conversion he wants, or make it two different programs. By the way, doing so will be easier if the different tasks have been separated. Combine variable declaration and value assignment. You wrote double fahrenheit, celsius; and later e.

This way, when reading your program maybe half a year later , you immediately see at the same place that celsius is a double number coming from some input. Using two separate characters does the job in a more robust way. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Learn more. Improve this answer. Kevin Krumwiede Kevin Krumwiede 9, 4 4 gold badges 31 31 silver badges 73 73 bronze badges. Convert Celcius to Fareiheit 2. Convert Fareiheit to Celcius 3. Update default temperature 1 Enter temperature in Celcius to convert into Farenheit 60 Update default temperature 2 Enter temperature in Farenheit to convert into Celcius Update default temperature 3 Enter temperature in celcius 25 Default temperatures: Update default temperature Temperature.

Convert Celcius to Fareiheit" ; System. Convert Fareiheit to Celcius" ; System. Chiranjeevi Chiranjeevi 41 1 1 silver badge 7 7 bronze badges. Do not post the same answer multiple times. You already posted this here stackoverflow. I wrote the whole thing all over again since as said in the comments you did not write in OOP: This is the main OOP part, a class that creates objects of temperature. Tomer Tomer 7 7 silver badges 19 19 bronze badges.

Kavindu Gayan Kavindu Gayan 5 5 silver badges 12 12 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.



0コメント

  • 1000 / 1000