{"id":155,"date":"2015-07-20T14:45:12","date_gmt":"2015-07-20T11:45:12","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=155"},"modified":"2015-07-22T23:16:42","modified_gmt":"2015-07-22T20:16:42","slug":"155","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=155","title":{"rendered":"Between two values"},"content":{"rendered":"<h1>Task<\/h1>\n<p>Were given three real numbers x, y, z. Check whether the inequality [latex]x &lt; y &lt; z[\/latex] is correct. If it is correct, show as an result the word<strong> &#171;true&#187;.<\/strong> If it is not correct, show as an result the word<strong> &#171;false&#187;.<\/strong><\/p>\n<h1>Tests<\/h1>\n<table>\n<tbody>\n<tr>\n<td>Input<\/td>\n<td>Output<\/td>\n<\/tr>\n<tr>\n<td> 8 9 25 <\/td>\n<td>\u00a0true<\/td>\n<\/tr>\n<tr>\n<td> 9 25 8 <\/td>\n<td> false<\/td>\n<\/tr>\n<tr>\n<td> 8 25 9 <\/td>\n<td>\u00a0false <\/td>\n<\/tr>\n<tr>\n<td> 9 8 25<\/td>\n<td>\u00a0false <\/td>\n<\/tr>\n<tr>\n<td>25 8 9<\/td>\n<td>\u00a0false <\/td>\n<\/tr>\n<tr>\n<td>25 9 8 <\/td>\n<td>\u00a0false <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>Solution<\/h1>\n<p>With &#171;if&#187; statement:<\/p>\n<pre class=\"lang:java decode:true\" title=\"http:\/\/ideone.com\/jlFK3x\">import java.util.*;\r\nimport java.util.*;\r\n\r\nclass Main{\r\n\tpublic static void main (String[] args) throws java.lang.Exception {\r\n\t\tScanner s = new Scanner(System.in);\t\r\n\t\tint x = s.nextInt();\r\n\t\tint y = s.nextInt();\r\n\t\tint z = s.nextInt();\r\n                \r\n\t\tif(x &lt; y &amp;&amp; y &lt; z) {\r\n\t\t\tSystem.out.println(&quot;true&quot;);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tSystem.out.println(&quot;false&quot;);\r\n\t\t}\r\n\t\ts.close();\r\n\t}\r\n}\r\n<\/pre>\n<p>Code refactoring<\/p>\n<pre class=\"lang:java decode:true \" title=\"http:\/\/ideone.com\/fork\/jlFK3x\">import java.util.*;\r\nimport java.util.*;\r\n \r\nclass Main{\r\n\tpublic static void main (String[] args) throws java.lang.Exception {\r\n\t\tScanner s = new Scanner(System.in);\t\r\n\t\tint x = s.nextInt();\r\n\t\tint y = s.nextInt();\r\n\t\tint z = s.nextInt();\r\n\t\r\n\t\tSystem.out.println(x &lt; y &amp;&amp; y &lt; z? true : false);\t\t\r\n\t\ts.close();\r\n\t}\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Task Were given three real numbers x, y, z. Check whether the inequality [latex]x &lt; y &lt; z[\/latex] is correct. If it is correct, show as an result the word &#171;true&#187;. If it is not correct, show as an result the word &#171;false&#187;. Tests Input Output 8 9 25 \u00a0true 9 25 8 false 8 &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=155\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":164,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[24],"jetpack_featured_media_url":"https:\/\/java.mazurok.com\/wp-content\/uploads\/tri-kotenka.jpg","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/155"}],"collection":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=155"}],"version-history":[{"count":7,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/155\/revisions"}],"predecessor-version":[{"id":165,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/155\/revisions\/165"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/media\/164"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}