0

for ループを実行していますが、6 人の患者を受け入れていますが、5 人しか受け入れないはずです。理由はわかりません。

患者クラス:

public Patient(final String ptNo, final String ptName,
        final String procDate, final int procType, final String injury,
        final String drName) throws IOException
{
    Patient.ptNo = getPtNo();
    Patient.ptName = getPtName();
    Patient.procDate = getProcDate();
    Patient.procType = getProcType();
    Patient.injury = getPtNotes();
    Patient.drName = getDrName();
}

編集する必要がないことに気づきましたgetNewPt

public static Patient getNewPt(String ptNo, String ptName,
        String procDate, int procType, String 
        injury, String drName) throws IOException
{
    Patient newPt = new Patient (ptNo,
            ptName, procDate, procType, injury, drName);

    return newPt;
}

患者管理クラス:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class PatientManagementSystem
{
    static BufferedReader stdin = new BufferedReader(new InputStreamReader(
            System.in));

    public static void main(String[] args) throws IOException
    {

        Patient.getNewPt(null, null, null, 0, null, null);
        // creating an array of 5 patients
        Patient patients[] = new Patient[5];

        int i = 0;

        for (i = 0; i < 5; i++)
        {
            patients[i] = Patient.getNewPt(null, null, null, i, null, null);

        }
        Patient.getOption();
    }
}

呼び出しによるものではありませんPatient.getOption();。何か案は?

4

1 に答える 1