Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I am working on a java assignment in java programming. The assignment is called WriteEmployeeList. The code looks fine; it prompts me the information;

Hi, I am working on a java assignment in java programming. The assignment is called WriteEmployeeList. The code looks fine; it prompts me the information; but does not display the information once you type 999 to quit. Here is my code for the assignment so far:

import java.io.File;

import java.io.PrintWriter;

import java.util.Scanner;

public class WriteEmployeeList

{

public static void main(String[] args)

{

String fileName = "employeeData.txt";

Scanner scanner = new Scanner(System.in);

PrintWriter writer = null;

String delimiter = ",";

String s;

int id;

String firstName;

String lastName;

final int QUIT = 999;

try

{

writer = new PrintWriter(new File(fileName));

System.out.print("Enter employee ID number >> ");

id = Integer.parseInt(scanner.nextLine());

while(id != QUIT)

{

System.out.print("First name >> ");

firstName = scanner.nextLine();

System.out.print("Last Name >>> ");

lastName = scanner.nextLine();

s = id + delimiter + firstName + delimiter + lastName;

writer.println(s);

System.out.print("Enter next ID number or " + QUIT + "to quit");

id = Integer.parseInt(scanner.nextLine());

}

writer.close();

}

catch(Exception e)

{

System.out.println("Message: " + e);

}

}

}

what I have to do is make a program that accepts a series of Employee ID numbers, first names, and last names and save it to a file. When executed, I am supposed to enter the multiple records that display the same first name.

Here is my txt file:

Employee ID number: 100 Employee First Name: john Employee Last Name: sundar Employee ID number: 101 Employee First Name: john Employee Last Name: shekar Employee ID Number: 102 Employee First Name: john Employee Last Name: watson Employee ID number: 103 Employee First Name: kim Employee Last Name: john

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genetic Databases

Authors: Martin J. Bishop

1st Edition

0121016250, 978-0121016258

Students also viewed these Databases questions

Question

how do trade practice laws effect the recruitment process

Answered: 1 week ago

Question

How does selection differ from recruitment ?

Answered: 1 week ago