Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.93 KB | None | 0 0
  1. /**
  2.  * @(#)kerusi.java
  3.  *
  4.  *
  5.  * @author @ LowKey 2011 hisyamnasir@gmail.com
  6.  * @version 1.00 2011/1/18
  7.  */
  8.  
  9. import java.util.Scanner;
  10. import java.lang.String;
  11.  
  12. public class kerusi {
  13.  
  14.  
  15.     public static void main(String[] args) {
  16.  
  17.         Scanner obj = new Scanner(System.in);
  18.         System.out.println("height?");
  19.          double height = obj.nextDouble();
  20.                  System.out.println("width?");
  21.                      double width = obj.nextDouble();
  22.                             System.out.println("length?");
  23.                              double length = obj.nextDouble();
  24.                                     System.out.println("weight?");
  25.                                      double weight = obj.nextDouble();
  26.  
  27.      //    method
  28.         String type; // declare type
  29.  
  30.  
  31.         // this value for height
  32.         // if height >= 0.5 and <=1.5 it will choose Armchair
  33.         if (height >= 0.5 && height <= 1.5) {
  34.             type = "Armchair";
  35.         // if height >= 0.5 and <=1.0 it will choose Bar Stool
  36.         } else if (height >= 1 && height <= 1.0) {
  37.             type = "Bar Stool";
  38.         // if height >= 0.5 and <=1.5 it will choose Bench
  39.         } else if (height >= 0.5 && height <= 1.5) {
  40.             type = "Bench";
  41.         } else {
  42.             type = "Unknown";
  43.         }
  44.  
  45.         // this value for width
  46.         // if width >= 0.5 and <=1.0 it will choose Armchair
  47.         if (width >= 0.5 && width <= 1.0) {
  48.             type = "Armchair";
  49.         // if width >= 0.14 and <=0.25 it will choose Bar Stool
  50.         } else if (width >= 0.14 && width <= 0.25) {
  51.             type = "Bar Stool";
  52.         // if width >= 1.0 and <=3.0 it will choose Bench
  53.         } else if (width >= 1.0 && width <= 3.0) {
  54.             type = "Bench";
  55.         } else {
  56.             type = "Unknown";
  57.         }
  58.  
  59.         // this value for length
  60.         // if length >= 0.14 and <=0.25 it will choose Armchair
  61.         if (length >= 0.14 && length <= 0.25) {
  62.             type = "Armchair";
  63.         // if length >= 0.14 and <=0.25 it will choose Bar Stool
  64.         } else if (length >= 0.14 && length <= 0.25) {
  65.             type = "Bar Stool";
  66.         // if length >= 0.14 and <=0.25 it will choose Bench
  67.         } else if (length >= 0.14 && length <= 0.25) {
  68.             type = "Bench";
  69.         } else {
  70.             type = "Unknown";
  71.         }
  72.  
  73.  
  74.         // this value for weight
  75.         // if weight >= 5 and <=18 it will choose Armchair
  76.         if (weight >= 5 && weight <= 18) {
  77.             type = "Armchair";
  78.         // if weight >= 3.0 and <=7 it will choose Bar Stool
  79.         } else if (weight >= 3.0 && weight <= 7) {
  80.             type = "Bar Stool";
  81.         // if weight >= 10 and <=50 it will choose Bench
  82.         } else if (weight >= 10 && weight <= 50) {
  83.             type = "Bench";
  84.         } else {
  85.             type = "Unknown";
  86.         }
  87.               System.out.println("Type of Kerusi = " + type);
  88.  
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement