Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Program DistanceTester
- * Alyiah Proctor
- * 1/30/18
- * Description: This program prints the distance between two points on a graph
- * What I learned: I learned how to create objects and using multiple classes
- * Difficulties: I had difficulty trying to print the toString. Other than that It was a simple tester program
- */
- import java.io.*;
- import java.util.*;
- public class DistanceTester
- {
- /**
- * Main
- * Finds the info of a number entered by the user
- * pre: Number class
- * post: Specs of the Number returned based on user input
- */
- public static void main(String[]args)
- {
- //setting up scaner
- Scanner kbReader = new Scanner(System.in);
- //header
- 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");
- //sets up a new distance object
- DistanceAP cords = new DistanceAP(kbReader.nextInt(), kbReader.nextInt(), kbReader.nextInt(),kbReader.nextInt());
- //prints the toString
- System.out.println(cords);
- }
- }
- /*
- * Sample output
- Enter two cordinates you would like to find the distance of without commas or parenthesis
- For example (1,0) (2,4) would be entered as 1 0 2 4
- 5 8 2 1
- The distance between the two points are 3.1623 units
- */
Add Comment
Please, Sign In to add comment