Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello! I need help writing a Java method that when given a user inputted last or first name, it will read through a text file,

Hello! I need help writing a Java method that when given a user inputted last or first name, it will read through a text file, find said name, and display that names associated cell and homephone number.

Below is the following provided code, if you have any questions please ask. Thanks!

import java.util.*; import java.io.*;

class Hw1 {

public static void main(String[] args) throws Exception { boolean loop = true; File file = new File("Hw1_Data.txt"); FileWriter fw = new FileWriter(file, true); fw.write("Hw 1 Data"); fw.write(" " + "last,first:cell,5021934246;home,4556784517"); // do { } (loop) fw.close(); }

// METHOD TO BE WRITTEN BY YOU! void display(String name) {}; // Display: Given a name, display the cell and home number associated with that name

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

List out some inventory management techniques.

Answered: 1 week ago