Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java, I am reading txt. file from command line. Each line has a name followed by a number. I want to create an array

In Java,

I am reading txt. file from command line. Each line has a name followed by a number. I want to create an array thats size is twice the number of names in the txt file. I want to hash the names(key) by adding the ascii value of each letter then diving by size of array and taking the remainder as the location in the array. After each insertion into the array I want to print the location, name and number.

example input txt. file

joe 23

mary 2

bob 12

import java.io.*;

public class Sys {

public static void main(String[] args)throws Exception{ String inpfile=args[0]; FileReader fr= new FileReader(inpfile); BufferedReader br = new BufferedReader(fr); String st, inputStrings=""; //read strings from file System.out.println("Reading strings from file...");

}

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

Compare the different types of employee separation actions.

Answered: 1 week ago