Computer Science > Research Paper > Heart Transplant. java (All)
/************************************************************************* * Compilation: javac HeartTransplant.java * Execution: java HeartTransplant < data.txt * * @author: * *****************... ********************************************************/ public class HeartTransplant { /* ------ Instance variables -------- */ // Person array, each Person is read from the data file private Person[] listOfPatients; // SurvivabilityByAge array, each rate is read from data file private SurvivabilityByAge[] survivabilityByAge; // SurvivabilityByCause array, each rate is read from data file private SurvivabilityByCause[] survivabilityByCause; /* ------ Constructor -------- */ /* * Initializes all instance variables to null. */ public HeartTransplant() { // WRITE YOUR CODE HERE this.listOfPatients=null; this.survivabilityByAge=null; this.survivabilityByCause=null; } /* ------ Methods -------- */ /* * Inserts Person p into listOfPatients * * Returns: 0 if successfully inserts p into array, * -1 if there is not enough space to insert p into array */ public int addPerson(Person p, int arrayIndex) { if(arrayIndex<=listOfPatients.length-1){ listOfPatients [arrayIndex]=p; return 0; } return -1; } [Show More]
Last updated: 1 year ago
Preview 1 out of 7 pages
Connected school, study & course
About the document
Uploaded On
Apr 21, 2021
Number of pages
7
Written in
This document has been written for:
Uploaded
Apr 21, 2021
Downloads
1
Views
55
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·