Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java program This is the Stock.txt if you need it: import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Random; import java.util.Scanner; public class WriteStringsToFile { public

Java program

image text in transcribed

This is the Stock.txt if you need it:

import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Random; import java.util.Scanner;

public class WriteStringsToFile { public static void main(String args[]) throws FileNotFoundException, UnsupportedEncodingException { String data[] = {"IBM, International Business Machines Corporation, 144.84, 5/2/2016", "AAPL, Apple Inc. 92.63, 5/2/2016", "ORCL, Oracle Corporation, 45.96,4/26/2018", "CSCO, Cisco Systems, 44.21, 4/26/2018"}; PrintWriter writer = new PrintWriter("stocks.txt", "UTF-8"); int res; for(int i = 0;i

Write a program to read data from the file stock.txt. for each line of data create an object of Stock class and store them in 1) ArrayList 2) a hash map as HashMap. The key will be the Symbol field (like IBM or CSCO) 3) Ask user to enter the symbol 4) Call a method searchArrayList(ArrayList, symbol) to search the ArrayList for the Symbol and return the price 5) Call a method searyHash(Hash,symbol) to search the Hash for the symbol and return the price 6) Call method printArrayList to print all the information of Stock 7) Call method printHash to print all the information of Stock in 8) Add one more Stock (ORCL, Oracle Corporation, 45.96, 9) Call method printArrayList to print all the information of Stock 10) Call method printHash to print all the information of in sorted order of Symbol sorted order of Symbol 4/26/2018) to both ArraList and HashMap in sorted order of Symbol Stock in sorted order of Symbol Write a program to read data from the file stock.txt. for each line of data create an object of Stock class and store them in 1) ArrayList 2) a hash map as HashMap. The key will be the Symbol field (like IBM or CSCO) 3) Ask user to enter the symbol 4) Call a method searchArrayList(ArrayList, symbol) to search the ArrayList for the Symbol and return the price 5) Call a method searyHash(Hash,symbol) to search the Hash for the symbol and return the price 6) Call method printArrayList to print all the information of Stock 7) Call method printHash to print all the information of Stock in 8) Add one more Stock (ORCL, Oracle Corporation, 45.96, 9) Call method printArrayList to print all the information of Stock 10) Call method printHash to print all the information of in sorted order of Symbol sorted order of Symbol 4/26/2018) to both ArraList and HashMap in sorted order of Symbol Stock in sorted order of Symbol

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

1. Who will you assemble on the team?

Answered: 1 week ago

Question

4. Who would lead the group?

Answered: 1 week ago