I am creating a program that will show user how many feet they have travel while driving if they were texting.
So far this is what I got, If the user is driving at 60 MPH, one second of distraction will travel 88ft. If the user is driving at 20MPH, one second of distraction will travel 29ft. ETC.
The problem that I am having trouble figuring out is that if I increment the seconds on this method c.SetHourstoSeconds(1). My program starts dividing, instead of multiplying. I have created new methods but so far I am completely lossed of how to make it work. Thanks in advance.
public class App {
public App() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Conversions c = new Conversions();
c.SetMilestoFeet(60);
c.SetHourstoSeconds(1);
System.out.println("Total feet travel " + c.Total() + "ft");
}
}
public class Conversions {
static int Milestofeet =0;
static int MinutestoSeconds =0;
public Conversions() {
}
public static void SetMilestoFeet(int x)
{
Milestofeet = x * 5280;
}
public static void SetHourstoSeconds(int hr)
{
int hourstoMinutes = hr * 60;
MinutestoSeconds = hourstoMinutes * 60;
System.out.println("***********" + hr);
}
public static int Sec()
{
return MinutestoSeconds;
}
public static int Feet()
{
return Milestofeet;
}
public int Total()
{
System.out.print(Milestofeet + " ___" + MinutestoSeconds + "______=" );
return (Feet()/Sec());
}
}