Question: A program has been started for you: doctor_project.java . You must finish the code to read data from a data file into the parallel arrays

A program has been started for you: doctor_project.java. You must finish the code to read data from a data file into the parallel arrays as follows: (the arrays are already defined in the code)

  • Patient Number (5 digits)
  • Patient name
  • Doctor last name (Smith, Jones, or Atkins)
  • Type of surgery (hip, knee, heart)
  • Cost of surgery

The data file that is to be used is surgery.txt and is included with this assignment.

In order for the program to find the correct data file, it MUST be copied to the main folder of your project. For example, if the project is called doctor_project, there will be a folder under workspace called doctor_project. This is where you MUST copy the file. When the program runs it will look for it in that folder.

Method stubs have also been written for you. These are methods that are called at the proper time, but do not have code created yet.

You are to finish these stubs as follows:

  1. start_program() read all data from the data file into parallel arrays. The valiable count will keep track of how many elements have been read in
  2. print_all() - List of all information in the arrays
  3. print_doctor_surgery()- List of all surgeries for a specific doctor (prompt for the doctor)
  4. print_surgery_specific_type()-List of all surgeries of a specific type (prompt for the surgery type)
  5. print_all_fees()-Total amount of surgery fees paid to each Doctor
  6. new_report()- Report of your choice (make up a report)

There are a number of programs stored with this assignment link that show how to read a text file into parallel arrays and how to search the arrays.

What to turn in:

  1. Create a word document with your name and date at the top
  2. Copy your java source code next
  3. Copy a Screen print of each of your reports running next

package doctor_project; import javax.swing.JOptionPane; import java.io.*; import java.util.*; import java.text.*; public class doctor_project { public static void main(String[] args) { int selection; int[] pnumber=new int[100]; String[] patname=new String[100]; String[] docname=new String[100]; String[] surgery=new String[100]; double[] cost=new double[100]; int count=-1; start_program(); selection=menu(); while (selection !=6) { if(selection ==1) print_all(); else if (selection ==2) print_doctor_surgery(); else if(selection ==3) print_surgery_specific_type(); else if(selection ==4) print_all_fees(); else if(selection==5) new_report(); selection=menu(); }//end of while loop }//end of main method //****************************************************************************** public static void start_program() { }//end start_program //****************************************************************************** public static int menu() { int selection; String value; String output="HOSPITAL REPORT MENU"+" "+ "=================="+" "+ "1. Print all information"+" "+ "2. All surgeries for a specific Dcotor"+" "+ "3. All surgeries of a specific type"+" "+ "4. Fees Paid to each Doctor"+" "+ "5. Report of your choice"+" "+ "6. Exit"+" "+ "Enter your slection > "; value =JOptionPane.showInputDialog(null, output,"Input Data",JOptionPane.QUESTION_MESSAGE); selection =Integer.parseInt(value); return selection; }//end menu //****************************************************************************** public static void print_doctor_surgery() { System.out.println(" "+"Executing print_doctor_surgery"); } //****************************************************************************** public static void print_all() { System.out.println(" "+"Executing print_all"); } //****************************************************************************** public static void print_surgery_specific_type() { System.out.println(" "+"Executing print_surgery_specific_type"); } //****************************************************************************** public static void print_all_fees() { System.out.println(" "+"Executing print_all_fees"); } //****************************************************************************** public static void new_report() { System.out.println(" "+"Executing new_report"); } //****************************************************************************** }

12345#William Gallo#Smith#knee#12000# 45671#Mary Hilling#Jones#knee#1300.99# 98761#Peter Green#Atkins#hip#7819.99# 88881#Gregory Allen#Jones#heart#12989.99# 77771#Eric Richards#Jones#heart#10989# 28923#Gina Carbon#Atkins#knee#6789.55# 44444#Julia Landon#Smith#hip#4500# 22222#Keri Fisher#Jones#hip#4999# 92816#Andrew Johnson#Smith#heart#14989.99# 10002#Philip Bosley#Jones#knee#6189.77# 98885#Thomas Brown#Atkins#knee#5987.99#

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!