Git Product home page Git Product logo

unitconverter's Introduction

Jetbrains Academy - Unit Converter

My solutions for the Jetbrains Academy Problem Unit Converter

https://hyperskill.org/projects/70

The solution is build up step by step over several stages. Stage 1 is the first and simple one. The following stages build up on the previous stages and get more and more advanced. There are five stages in total.

Because each stage is completely independent of the previous one, IntelliJ might show some warnings about duplicated code between the stages.

Stage 1/5

click here to see description @ JetBrains Academy

Just some basic output.

just execute this:

gradle -PmainClass=stage1.MainKt run --console=plain

145 centimeters is 1.45 meters
2 miles is 3.2187 kilometers
5.5 inches is 139.7 millimeters
12 degrees Celsius is 53.6 degrees Fahrenheit
3 pounds is 1.360776 kilograms

Stage 2/5

click here to see description @ JetBrains Academy

We can convert kilometer into meter.

just execute this:

gradle -PmainClass=stage2.MainKt run --console=plain

Enter a number of kilometers:
123
123 kilometers is 123000 meters

Stage 3/5

click here to see description @ JetBrains Academy

We can convert some length dimensions.

just execute this:

gradle -PmainClass=stage3.MainKt run --console=plain

Enter a number and a measure of length:
1234 mm
1234.0 millimeters is 1.234 meters

Stage 4/5

click here to see description @ JetBrains Academy

Now we can convert lengths and weights.

just execute this:

gradle -PmainClass=stage4.MainKt run --console=plain

Enter what you want to convert (or exit): 2 m in yards
2.0 meters is 2.1872265966754156 yards

Enter what you want to convert (or exit): 75 kg in pounds
75.0 kilograms is 165.34683151378331 pounds

Enter what you want to convert (or exit): exit

Stage 5/5

click here to see description @ JetBrains Academy

Here we add the ability to convert temperatures.

just execute this:

gradle -PmainClass=stage5.MainKt run --console=plain

Enter what you want to convert (or exit): 1 C in K
1.0 degree Celsius is 274.15 kelvins

Enter what you want to convert (or exit): 33 C in F
33.0 degrees Celsius is 91.4 degrees Fahrenheit

Enter what you want to convert (or exit): exit

unitconverter's People

Contributors

marckoch avatar

Watchers

 avatar

unitconverter's Issues

Exception

Exception in test #8

java.lang.NumberFormatException: For input string: "random"
at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.base/java.lang.Double.parseDouble(Double.java:651)
at stage5.MainKt.processInput(Main.kt:103)
at stage5.MainKt.main(Main.kt:38)
at stage5.MainKt.main(Main.kt)

Please find below the output of your program during this failed test.
Note that the '>' character indicates the beginning of the input line.


Enter what you want to convert (or exit): > Random string without numbers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.