Write a (very short) program that creates a serial text file holding just two or three names of your own choosing.

1.Write a (very short) program that creates a serial text file holding just two or three names of your own choosing. After compiling and running the program, use the MS-DOS command type (or the equivalent command for your platform) to display the file's contents. For example:

 

type names.txt

2. Using a text editor or word processor, create a text file containing a series of

five surnames and examination marks, each item on a separate line. For

example:

Smith

47

Jones

63

By extending the code given below, create a random access file called

results.dat, accepting input from the standard input stream (via a Scanner

object) and redirecting input from the above text file. Each record should

comprise a student surname and examination mark. When all records have been  written, reposition the file pointer to the start of the file and then read each record in turn, displaying its contents on the screen.

import java.io.*;

import java.util.*;

public class FileResults

{

private static final long REC_SIZE = 34;

private static final int SURNAME_SIZE = 15;

private static String surname;

private static int mark;

public static void main(String[] args)

throws IOException

{

/**********************************************

*** SUPPLY CODE FOR main! ***

**********************************************/

}

public static void writeString(

RandomAccessFile file, String text,

int fixedSize) throws IOException

{

int size = text.length();

if (size<>

{

file.writeChars(text);

for (int i=size; i

file.writeChar(' ');

}

else

file.writeChars(text.substring(

0,fixedSize));

}

public static String readString(

RandomAccessFile file, int fixedSize)

throws IOException

{

String value = “”;

for (int i=0; i

value+=file.readChar();

return value;

}

}

 

find the cost of your paper

prepare a lead container of mass 1.5 kg and pour 0.65 kg of water into it, both at the room temperature of 20.5°C.

You are at a restaurant eating lunch with a friend. After the meal, your friend realizes they left their wallet at home. Your friend gives you a piece of silver….

Given the above information, how many people did McKinsey and BCG hire in the year 2013?

There are two big consulting firms in Melbourne, McKinsey and Boston Consulting Group (BCG); assume that their clients view them as providing identical consulting services. They hire people on yearly….

write a program that reads a file and displays all of the words in it that are misspelled.

A spell checker can be a helpful tool for people who struggle to spell words correctly. In this exercise, you will write a program that reads a file and displays….