Answer to Question #234783 in Java | JSP | JSF for guru

Question #234783
  1. Create a program that takes in the following CMD arguments: A car’s plate number (registration number), arrival time and departure time plus the cost for staying in the parking lot. Your task then  is to take these given information to print a simple receipt as indicated below (Don’t worry about the calculations for now.)

Sample run 1:

Java lab01_task04 N88W 8h30 9h45 6.25

Output:

Vehicle Details

N88W

++++++++++++++++++++++

Arrival             8h30

Departure       9h45

++++++++++++++++++++++

 Total Cost: N$ 6.25

++++++++++++++++++++++


1
Expert's answer
2021-09-09T00:00:47-0400
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("++++++++++++++++++++++++++++");
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS