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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started