64 712
Assignments Done
99,4%
Successfully Done
In September 2018

Answer to Question #51017 in Java | JSP | JSF for Charles Wang

Question #51017
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:
Expert's answer
Use the function Replace.
Example:
Str.replace('l', 'D'));

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions