File tree Expand file tree Collapse file tree 4 files changed +39
-3
lines changed
app/src/main/java/io/github/project516/JavaTemperatureConverter Expand file tree Collapse file tree 4 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -9,5 +9,7 @@ public class Main {
99 public static void main (String [] args ) {
1010
1111 System .out .println (info .vendor ());
12+ Runtime run = new Runtime ();
13+ run .run ();
1214 }
1315}
Original file line number Diff line number Diff line change 11package io .github .project516 .JavaTemperatureConverter ;
22
3- import io .github .project516 .jlibutils .ScannerHelper ;
3+ import java .nio .charset .StandardCharsets ;
4+ import java .util .*;
45
56public class Runtime {
67
7- ScannerHelper scan = new ScannerHelper ();
8+ Scanner scan = new Scanner (System .in , StandardCharsets .UTF_8 .name ());
9+ ConvertTemp temp = new ConvertTemp ();
810
9- void run () {}
11+ void run () {
12+
13+ try {
14+ String input = scan .nextLine ().toLowerCase ();
15+
16+ if (input .equals ("f" )) {
17+ System .out .println ("Enter Celcus" );
18+ Double cel = scan .nextDouble ();
19+ System .out .println (temp .cToF (cel ));
20+ } else if (input .equals ("c" )) {
21+ System .out .println ("Enter Farenghitght" );
22+ Double far = scan .nextDouble ();
23+ System .out .println (temp .fToC (far ));
24+ } else {
25+ System .out .println ("Invalid input!" );
26+ }
27+
28+ } catch (Exception e ) {
29+ System .out .println (e );
30+ }
31+ }
1032}
Original file line number Diff line number Diff line change 1+ package io .github .project516 .JavaTemperatureConverter ;
2+
3+ public class Text {
4+ void printInst () {
5+ System .out .println (
6+ "Enter f to convert Celcius to Farenght and c to convert Farenght to Celceus\n " );
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ ./gradlew build || exit 1
4+ java -jar app/build/libs/app-all.jar
You can’t perform that action at this time.
0 commit comments