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

Get your Assignment in a Minimum of 3 hours

Our academic experts are ready and waiting to assist with any writing project you may have. From simple essay plans, through to full dissertations, you can guarantee we have a service perfectly matched to your needs.

Free Inquiry Order A Paper Now Cost Estimate

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

The post Write a (very short) program that creates a serial text file holding just two or three names of your own choosing. appeared first on Best Custom Essay Writing Services | EssayBureau.com.

"Is this question part of your assignment? We Can Help!"

"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"

Get Started