Examlex
import java.nio.file.*;
import java.io.*;
import java.nio.channels.FileChannel;
import java.nio.ByteBuffer;
import static java.nio.file.StandardOpenOption.*;
import java.util.Scanner;
public class CreateEmployeesRandomFile
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
Path file =
Paths.get("C: \\Java\\Chapter.13\\RandomEmployees.txt");
String s = "000, ,00.00" +
System.getProperty("line.separator");
final int RECSIZE = s.length();
FileChannel fc = null;
String delimiter = ",";
String idString;
int id;
String name;
String payRate;
final String QUIT = "999";
try
{
fc = (FileChannel)Files.newByteChannel(file, READ, WRITE);
System.out.print("Enter employee ID number >> ");
idString = input.nextLine();
while(!(idString.equals(QUIT)))
{
_____________________________
System.out.print("Enter name for employee #" +
id + " >> ");
name = input.nextLine();
System.out.print("Enter pay rate >> ");
payRate = input.nextLine();
s = idString + delimiter + name + delimiter +
payRate + System.getProperty("line.separator");
byte[] data = s.getBytes();
ByteBuffer buffer = ByteBuffer.wrap(data);
_____________________________
fc.write(buffer);
System.out.print("Enter next ID number or " +
QUIT + " to quit >> ");
idString = input.nextLine();
}
fc.close();
}
catch (Exception e)
{
System.out.println("Error message: " + e);
}
The above program will accept any number of employee records as user input and write the records to a file in a loop. In the first shaded line, create the statement to accept the employee data value from the keyboard as a String and convert it to an integer using the parseInt() method. In the second shaded line, create the statement to compute the record's desired position by multiplying the ID number value by the record size.
Respiratory Centers
Centers in the medulla and pons that regulate breathing.
Chemoreceptors
Sensory receptors that respond to chemical stimuli, such as those found in the nose and taste buds.
Ventral Medulla
A key section of the brainstem involved in regulating autonomic functions, such as heart rate and breathing.
Oxygen Concentration
The amount of oxygen present in a given environment, important for various biological and chemical processes.
Q13: import java.nio.file.*;<br>import java.io.*;<br>public class ReadFile<br>{<br>public static void
Q26: When you create a number of classes
Q26: If you were to hear someone singing
Q34: The state of a JCheckBoxMenuItem or JRadioButtonMenuItem
Q35: import javax.swing.*;<br>public class JFrameLook<br>{<br>public static void main(String[]
Q39: What is an abstract class? Give an
Q46: What are unchecked exceptions? Give an example.
Q56: In the drawPolygon() method, what are the
Q56: Regarding enumerations, the _ method returns an
Q139: Describe the sociological theories that developed from