How do I make is so that I am able to, not only enter and save data, but also edit it. Here is my code.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Scanner;
public class Catalog {
static String fileName = null;
static Hospital lib = new Hospital();
static Scanner in = new Scanner(System.in);
static Boolean running = true;
public static void main(String[] args) {
while (running) {
System.out.println("\nEnter 0 to load a hospital."
+ "\nEnter 1 to save and quit"
+ "\nEnter 2 for a list of all patients in the hospital"
+ "\nEnter 3 to add a patient to the hospital");
int answer = in.nextInt();
switch (answer) {
case 0:
System.out.println("Enter the file name to load");
loadScript(in.next());
break;
case 1:
saveAndQuit();
break;
case 2:
1
Expert's answer
2015-02-27T12:16:53-0500
Use the function Replace. Example: Str.replace('l', 'D'));
Comments
Leave a comment