JackHoughton00

p79ReviewPt2

Feb 17th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package p79reviewpt2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P79ReviewPt2 {
  6.  
  7. public static void main(String[] args) {
  8. double seg1;
  9. double seg2;
  10. double seg3;
  11. try (Scanner input = new Scanner(System.in)) {
  12. System.out.print("Enter the first segment length:");
  13. seg1 = input.nextDouble();
  14. System.out.print("Enter the second segment length:");
  15. seg2 = input.nextDouble();
  16. System.out.print("Enter the third segment length:");
  17. seg3= input.nextDouble();
  18. double total = seg1+seg2+seg3;
  19. System.out.print(total +"km was the total length of the race");
  20. }
  21.  
  22.  
  23. }
  24.  
  25. }
Add Comment
Please, Sign In to add comment