Question: ### Task 1: Parsing Data ( `Task1.java` ) Create a text file called `t1_input.txt` and it should contain the following data: ``` bJohnson:1001:wheel,admin:/home/bJohnson lamberton:1002:staff:/home/lamberton lmoody:1003:staff:/home/lmoody
### Task 1: Parsing Data (`Task1.java`)
Create a text file called `t1_input.txt` and it should contain the following data:
```
bJohnson:1001:wheel,admin:/home/bJohnson
lamberton:1002:staff:/home/lamberton
lmoody:1003:staff:/home/lmoody
error:1x00:error:/home/error
glowe:1004:manager:/home/glowe
```
Use the `Scanner` class to read the data from the file and separate by colons. Use `printf` to print the data in a "pretty" format.
* For parsing, make sure you use the `Scanner` class.
* Read in the second field as an `int`.
* Catch the appropriate exceptions for the potential errors:
* No such element (A field is blank)
* Input type mismatch (The field does not match the type)
Your output should match:
```
bJohnson 1001 wheel,admin /home/bJohnson
lamberton 1002 staff /home/lamberton
*** Error, not enough data.
lmoody 1003 staff /home/lmoody
*** Error, bad data format.
glowe 1004 manager /home/glowe
```
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
