Sample run 1:
Java lab01_task04 N88W 8h30 9h45 6.25
Output:
Vehicle Details
N88W
++++++++++++++++++++++
Arrival 8h30
Departure 9h45
++++++++++++++++++++++
Total Cost: N$ 6.25
++++++++++++++++++++++
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
String reg_number;
String arr_time;
String dep_time;
double cost;
Scanner in=new Scanner(System.in);
System.out.println("Enter registration number, arrival time, departure time and cost:");
reg_number=in.next();
arr_time=in.next();
dep_time=in.next();
cost=in.nextDouble();
System.out.println("Vehicle Details");
System.out.println("++++++++++++++++++++++++++++");
System.out.println("Arrival\t"+arr_time);
System.out.println("Departure\t"+dep_time);
System.out.println("++++++++++++++++++++++++++++");
System.out.println("Total Cost: N$"+cost);
System.out.println("++++++++++++++++++++++++++++");
}
}
Comments
Leave a comment