fork download
  1. import java.util.Scanner;
  2. import java.util.* ;
  3. class LMComplex {
  4. Scanner name = new Scanner(System.in);
  5. Scanner age = new Scanner(System.in);
  6. Scanner gender = new Scanner(System.in);
  7. Scanner height = new Scanner(System.in);
  8. String usrname;
  9. String usrage;
  10. String usrgender;
  11. Double usrheight;
  12. public void main(){
  13. System.out.println("Enter your name: ");
  14. usrname = name.nextLine();
  15. System.out.println("Enter your age(Numbers): ");
  16. usrage = age.nextLine();
  17. System.out.println("Enter your gender(male/female): ");
  18. usrgender = gender.nextLine();
  19. System.out.println("Enter your height(feet.inches . 5 feet 5 inches = 5.5): ");
  20. usrheight = height.nextDouble();
  21. Double rusrheight = Math.ceil(usrheight);
  22. if(rusrheight > usrheight)
  23. {
  24. rusrheight = rusrheight - 1;
  25. }
  26. else
  27. {
  28.  
  29. }
  30. Double rusrheightininches = usrheight - rusrheight;
  31. if(rusrheightininches >= 0.10 && rusrheightininches < 0.12)
  32. {
  33. rusrheightininches = rusrheightininches * 100;
  34. } else {
  35. rusrheightininches = rusrheightininches * 10;
  36. }
  37. Double rusrheightinincheschecker = rusrheightininches;
  38. rusrheightininches = Math.ceil(rusrheightininches);
  39. if(rusrheightininches > rusrheightinincheschecker)
  40. {
  41. rusrheightininches = rusrheightininches - 1;
  42. }
  43. else
  44. {
  45.  
  46. }
  47. System.out.println("Hii " + usrname + ". I am Cartic, a basic textual virtual personal assistant. I do know that you are " + usrage +" years old. You are a " + usrgender + " and are " + rusrheight + " feet " + rusrheightininches + " inch(es) tall");
  48. }
  49. public static void main(String[] argv) {
  50. try {
  51. new LMComplex().main();
  52. } catch (Exception e) {
  53. e.printStackTrace(System.out);
  54. }
  55. }
  56. }
Success #stdin #stdout 0.1s 380736KB
stdin
Foofle
42
male
4.99
stdout
Enter your name: 
Enter your age(Numbers): 
java.util.NoSuchElementException: No line found
	at java.util.Scanner.nextLine(Scanner.java:1585)
	at LMComplex.main(Main.java:16)
	at LMComplex.main(Main.java:51)