The first file is what I get from Argos for each class. It contains
1. Some blank lines
2. Header
    ◦ Date
    ◦ Who generated the report
    ◦ Course info: number, crn, instructor, name
3. Info for each student
    ◦ Student ID number
    ◦ Student last name, first name and MI
    ◦ Student classification
    ◦ Student major
    ◦ Student email
    ◦ "Status"
    ◦ "Status Date"
4. Legend
5. Header
    ◦ Date
    ◦ Who generated the report
    ◦ Course info: number, crn, instructor, name
6. Info for each student
7. Legend

The second file is a DOS batch file which contains some string literals (DOS commands) and the student's user id.

Notice that the student's user id is not directly listed in the Argos file. We can extract that from the student's email. There is other data in the file that is useful for other purposes, namely ID, last name, first name and user id.

What we will do is to develop a program which will extract the data from the roster file and produce a) the batch file and b) a flat file of ID, last name, first name and userid that can be used for other purposes. If we had b above, we could relatively easily produce a.

"Things" we will need to do
• Read data from an external file
• Extract info from that data
• Format/store that info in a useable form
• Utilize the info to produce a file
• Utilize the info to produce the batch file

Develop the class

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.


public class UseridProject_1 {

// Input roster file
final static String INPUT_ROSTER_FILE = "SampleRosterFile.txt";
// Output data file
final static String OUTPUT_DATA_FILE = "SampleDataFile.txt";
// Output batch file
final static String OUTPUT_BATCH_FILE = "SampleBatchFile.bat.txt";

// Main method for program execution
public static void main(String[] args) {
    System.out.println("Reading input file " + INPUT_ROSTER_FILE + " ..." + "\n");
    try(BufferedReader br = new BufferedReader(new FileReader(INPUT_ROSTER_FILE))) {
      FileWriter fwData = new FileWriter(OUTPUT_DATA_FILE);
      FileWriter fwBatch = new FileWriter(OUTPUT_BATCH_FILE);
      // Read line by line
      for(String line; (line = br.readLine()) != null; ) {
       // If line contains @, it has user information
       if (line.contains("@")) {
          // Split line based on whitespace
          String[] params = line.split("\\s+");
          int i = 1;
          // Gather ID from line
          String ID = params[i++];
          // Gather last name from line
          String lastName = params[i++];
          while (!lastName.contains(",")) {
            lastName += " " + params[i++];
          lastName = lastName.replace(",","");
          // Gather first name from line
          String firstName = params[i++];
          String username = "";
          // Gather username from line
          for (String param : params) {...

By purchasing this solution you'll be able to access the following files:

50% discount

$45.00 $22.50
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats