Answered You can hire a professional tutor to get the answer.

QUESTION

import java.util.Scanner; public class DistanceTraveledTest { public static void main(String args) { // TODO Auto-generated method stub int speed;

I'm trying to use the method (getDistance) in my first class (DistanceTravled) to calculate the distance traveled in my second class (DistanceTraveledTest). I have the loop working correctly for the hours, but for some reason the getDistance method will not work correctly and I've tried different things to get it to work. I've attached my JAVA classes. 

The output should read like this:                            

Hours you have driven: 3

How fast were you going: 40

Hours                 Distance traveled

1                                        40

2                                        80

3                                        120

  • Attachment 1
  • Attachment 2
import java.util.Scanner;public class DistanceTraveledTest {public static void main(String args) {// TODO Auto-generated method stubint speed;int time;int i;Scanner scan = new...
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question