Question: 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
Get step-by-step solutions from verified subject matter experts
