Examlex
import java.nio.file.*;
import java.io.*;
public class ReadEmployeeFile2
{
public static void main(String[] args)
{
Path file =
Paths.get("C:\\Java\\Chapter.13\\Employees.txt");
String[] array = new String[3];
String s = "";
String delimiter = ",";
int id;
String name;
double payRate;
double gross;
final double HRS_IN_WEEK = 40;
double total = 0;
try
{
InputStream input = new
BufferedInputStream(Files.newInputStream(file));
BufferedReader reader = new
BufferedReader(new InputStreamReader(input));
System.out.println();
s = reader.readLine();
while(s != null)
{
-----Code here-----
id = Integer.parseInt(array[0]);
name = array[1];
payRate = Double.parseDouble(array[2]);
gross = payRate * HRS_IN_WEEK;
System.out.println("ID#" + id + " " + name +
" $" + payRate + " $" + gross);
total += gross;
s = reader.readLine();
}
reader.close();
}
catch(Exception e)
{
System.out.println("Message: " + e);
}
System.out.println(" Total gross payroll is $" + total);
}
}
The above code demonstrates a retrieved file where Strings are split into usable fields. On the indicated line, write a String class split() method to split the String s that accepts an argument that identifies the field delimiter (in this example, a comma) and returns an array of Strings . The result should be assigned to the String[] array .
Saint-Denis
A suburb of Paris, France, known historically for the Basilica of Saint-Denis, a burial site of French royalty and a pioneering masterpiece of Gothic architecture.
Gothic Style
An architectural style that flourished in Europe during the High and Late Middle Ages, characterized by features such as pointed arches, ribbed vaults, and flying buttresses, emphasizing verticality and light.
Île-de-France
A region in north-central France that encompasses the city of Paris and its surrounding urban and rural areas.
Lombardy
A region in northern Italy known for its rich history, cultural heritage, and economic prosperity, also noted for its significant contributions to the arts and architecture during the Renaissance.
Q6: What is a subscript and how are
Q13: The _ property for a control will
Q16: <img src="https://d2lvgg3v3hfg70.cloudfront.net/TBX9006/.jpg" alt=" The above code
Q33: The calculated expression =City "," State "
Q35: In crosstab query results, the value of
Q41: Since variables declared within a try or
Q51: Case Based Critical Thinking Questions Case 5-1
Q52: The simplest possible sort involves two values
Q68: Which of the following statements correctly declares
Q69: Write the statement to provide a JTextField