ach line of the text file includes a vehicle make, color, plate number and the date of entry to the m ased on the content of this text file and the program result in the console, provide a line-by-line escription for the below java program. Note that this program cannot run since its required classe ave not been included.
ach line of the text file includes a vehicle make, color, plate number and the date of entry to the m ased on the content of this text file and the program result in the console, provide a line-by-line escription for the below java program. Note that this program cannot run since its required classe ave not been included.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
The class's name is : Hot Cars
![The attached text file lists all vehicles entered to the parking lot of a mega shopping centre for one day.
Each line of the text file includes a vehicle make, color, plate number and the date of entry to the mall.
Based on the content of this text file and the program result in the console, provide line-by-line
description for the below java program. Note that this program cannot run since its required classes
have not been included.
Pr...
Run:
.idea
out
src
Cars
logfile.txt
> Illli External Libraries
s ↓
Parking Lot
Scratches and Consoles
1
2
3
4
5
6
Green
Version Control ▶ Run
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
A
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Date;
public class E
public static void main(String[] args) {
try {
File text = new File( pathname: "logfile.txt");
Scanner input = new Scanner (text);
Parking Lot parking Cars=new Parking Lot ();
A
A
Mon Feb 24 09:00:40 EST 2020
Toyota
BDKK-863
A
TODO e Problems
int countLines=0;
while (input.hasNextLine()) {
}
}
String line = input.nextLine();
Date dd=strToDate (line.substring(29, 33).trim(), line.substring(35, 37).trim(), line.substring(37,39).trim(),
line.substring(40, 42).trim(), line.substring(43, 45).trim(), line.substring(46, 48).trim());
parkingCars.addCar (dd, Line.substring(1, 10).trim(), line.substring(11,19).trim(), line.substring(20, 28).trim());
countLines++;
System.out.println(countLines);
System.out.println (parkingCars.cars.get (2).dateIn);
System.out.println (parkingCars.cars.get (3).make);
System.out.println(parkingCars.cars.get(0).plate);
System.out.println (parkingCars.cars.get(1).color);
} catch (Exception e) {
System.out.println("Something is wrong in reading the text file, OR in converting the string to date!");
}
1 usage
public static Date strToDate(String year, String month, String day, String hour, String minute, String second)
throws ParseException {
String dateStr =""+day+"/"+month+"/"+year+" "+hour+":"+minute+": "+second;
SimpleDateFormat frmt=new SimpleDateFormat( pattern: "dd/MM/yyyy HH:mm:ss");
return frmt.parse (dateStr);
Terminal ▸ Services
Build
⠀](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd0de0f8a-cbae-4106-98d2-7bea7a49e126%2F2e420250-e0e1-4d3e-8074-74db5cb15941%2Ff2pgfa9_processed.png&w=3840&q=75)
Transcribed Image Text:The attached text file lists all vehicles entered to the parking lot of a mega shopping centre for one day.
Each line of the text file includes a vehicle make, color, plate number and the date of entry to the mall.
Based on the content of this text file and the program result in the console, provide line-by-line
description for the below java program. Note that this program cannot run since its required classes
have not been included.
Pr...
Run:
.idea
out
src
Cars
logfile.txt
> Illli External Libraries
s ↓
Parking Lot
Scratches and Consoles
1
2
3
4
5
6
Green
Version Control ▶ Run
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
A
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Date;
public class E
public static void main(String[] args) {
try {
File text = new File( pathname: "logfile.txt");
Scanner input = new Scanner (text);
Parking Lot parking Cars=new Parking Lot ();
A
A
Mon Feb 24 09:00:40 EST 2020
Toyota
BDKK-863
A
TODO e Problems
int countLines=0;
while (input.hasNextLine()) {
}
}
String line = input.nextLine();
Date dd=strToDate (line.substring(29, 33).trim(), line.substring(35, 37).trim(), line.substring(37,39).trim(),
line.substring(40, 42).trim(), line.substring(43, 45).trim(), line.substring(46, 48).trim());
parkingCars.addCar (dd, Line.substring(1, 10).trim(), line.substring(11,19).trim(), line.substring(20, 28).trim());
countLines++;
System.out.println(countLines);
System.out.println (parkingCars.cars.get (2).dateIn);
System.out.println (parkingCars.cars.get (3).make);
System.out.println(parkingCars.cars.get(0).plate);
System.out.println (parkingCars.cars.get(1).color);
} catch (Exception e) {
System.out.println("Something is wrong in reading the text file, OR in converting the string to date!");
}
1 usage
public static Date strToDate(String year, String month, String day, String hour, String minute, String second)
throws ParseException {
String dateStr =""+day+"/"+month+"/"+year+" "+hour+":"+minute+": "+second;
SimpleDateFormat frmt=new SimpleDateFormat( pattern: "dd/MM/yyyy HH:mm:ss");
return frmt.parse (dateStr);
Terminal ▸ Services
Build
⠀
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY