Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. package app.com;
  2. import java.util.ArrayList;
  3. import java.util.Scanner;
  4.  
  5. public class AstroApp
  6. {
  7. public static void main(String args[])
  8. {
  9. Scanner KeyboardInput = new Scanner( System.in );
  10. String NGCObject;
  11. System.out.println("Enter the NGC ID or the Name of the object you would like to view. ");
  12. NGCObject = KeyboardInput.next();
  13.  
  14. ArrayList<AstroObject> Target = new ArrayList<AstroObject>();
  15.  
  16. Target.add(new AstroObject("Crab_Nebula", 5.5756 ,22.0144 , 6, "1952", 8.4));
  17.  
  18. for(AstroObject item : Target)
  19. {
  20. if(NGCObject.equals(item.getNGCID()))
  21. {
  22. System.out.println(
  23. item.getName() +
  24. "." +
  25. "Its Ra And Dec are " +
  26. item.getRA() +
  27. " " +
  28. item.getDec() +
  29. " Its Size is " +
  30. item.getSize() +
  31. "'" + "
  32. Its Apparent Magnitude is " +
  33. item.getBrightness() +
  34. " Its NGC Number is: " +
  35. item.getNGCID()
  36. );
  37. }
  38. if(NGCObject.equals(item.getName()))
  39. {
  40. System.out.println(
  41. item.getName() +
  42. "." +
  43. "Its Ra And Dec are " +
  44. item.getRA() +
  45. " " +
  46. item.getDec() +
  47. " Its Size is " +
  48. item.getSize() +
  49. "'" +
  50. " Its Apparent Magnitude is " +
  51. item.getBrightness() +
  52. " Its NGC Number is: " +
  53. item.getNGCID()
  54. );
  55. }
  56. else
  57. {
  58. System.out.println("ERROR");
  59. }
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement