This is the coding i have come up with for a simple car rent java program. it compiles with no error but the output is not showing, so what should i do? Please help tx. I am a java beginner.
import java.util.Scanner;
public class carRent
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
String name, address;
double bodo,endodo, kilo;
double days, charge;
System.out.print("Name: ");
name=input.nextLine();
System.out.print("State: ");
address=input.nextLine();
System.out.print("Beginning Odometer : ");
bodo=input.nextDouble();
System.out.print("End Odometer : ");
endodo=input.nextDouble();
System.out.print("Days car used : ");
days=input.nextDouble();
kilo = endodo - bodo;
System.out.printf("\nKilometer car driven : ", + kilo ,"km");
System.out.printf("\nNumber of days rented : ", + days);
charge = days * 150.00 + kilo * 1.00;
System.out.printf("\nTotal charge of rent : ", + charge);
}
}
System.out.printf("%nKilometer car driven :%f.2km", kilo);%.2fdoes...Take a look at this for more examples