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 Hwl { public static void main(String[] args) throws Exception { boolean loop = true; File file = new File("Hwl_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 Jand 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
