So, I've created a program that when a user inputs a type of vehicle, it will print how much will the user pay for their fare. Here's what I have so far:
How do I call the methods Vehicle, Vehicle1, etc.. so that I am able to print the fare costs?
package commuting;
import java.util.Scanner;
public class Commuting {
public static void main(String[] args) {
String strVehicle;
Scanner sc = new Scanner (System.in);
System.out.print ("What mode of transportation will you be taking to school? ");
strVehicle = sc.next();
if (strVehicle.equals("Jeep") ){
System.out.print ("You're fare will be: " );
}
}
public static double Vehicle(String strVehicle){
double dJeep = 8.00;
return dJeep;
}
public static double Vehicle2(String strVehicle){
double dLRT = 15.00;
return dLRT;
}
public static double Vehicle3(String strVehicle){
double dMRT = 30.00;
return dMRT;
}
public static double Vehicle4(String strVehicle){
double dBus = 30.00;
return dBus;
}
public static double Vehicle5(String strVehicle){
double dTaxi = 100.00;
return dTaxi;
}
public static double Vehicle6(String strVehicle){
double dPedicab = 20.00;
return dPedicab;
}
}