Monty374

Distance Part 2 of 2

Sep 19th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. package distance.part.pkg2.of.pkg2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6. *
  7. * @author Monty
  8. */
  9. public class DistancePart2Of2 {
  10.  
  11. /**
  12. * @param args the command line arguments
  13. */
  14. public static void main(String[] args) {
  15. double d1;
  16. double d2;
  17. double d3;
  18. Scanner input = new Scanner(System.in);
  19.  
  20. System.out.print("Enter the first distance: ");
  21. d1 = input.nextDouble();
  22. System.out.print("Enter the second distance: ");
  23. d2 = input.nextDouble();
  24. System.out.print("Enter the third distance: ");
  25. d3 = input.nextDouble();
  26.  
  27. double dt;
  28. dt = d1 + d2 + d3;
  29. System.out.println("Total distance: " + dt);
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment