Guest User

Untitled

a guest
Feb 13th, 2018
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. /** Program DistanceTester
  2. * Alyiah Proctor
  3. * 1/30/18
  4. * Description: This program prints the distance between two points on a graph
  5. * What I learned: I learned how to create objects and using multiple classes
  6. * Difficulties: I had difficulty trying to print the toString. Other than that It was a simple tester program
  7. */
  8. import java.io.*;
  9. import java.util.*;
  10.  
  11. public class DistanceTester
  12. {
  13.  
  14. /**
  15. * Main
  16. * Finds the info of a number entered by the user
  17. * pre: Number class
  18. * post: Specs of the Number returned based on user input
  19. */
  20. public static void main(String[]args)
  21. {
  22. //setting up scaner
  23. Scanner kbReader = new Scanner(System.in);
  24.  
  25.  
  26. //header
  27. System.out.println("\n Enter two cordinates you would like to find the distance of without commas or parenthesis \n For example (1,0) (2,4) would be entered as 1 0 2 4");
  28.  
  29. //sets up a new distance object
  30. DistanceAP cords = new DistanceAP(kbReader.nextInt(), kbReader.nextInt(), kbReader.nextInt(),kbReader.nextInt());
  31.  
  32. //prints the toString
  33. System.out.println(cords);
  34. }
  35. }
  36.  
  37. /*
  38. * Sample output
  39. Enter two cordinates you would like to find the distance of without commas or parenthesis
  40. For example (1,0) (2,4) would be entered as 1 0 2 4
  41. 5 8 2 1
  42. The distance between the two points are 3.1623 units
  43.  
  44. */
Add Comment
Please, Sign In to add comment