実用的な目的で使用される Java の最初のプログラムに取り組んでいますが、正しくない出力が得られて行き詰まっています。
私が計算しようとしている問題は次のとおりです。私が働いている製造工場は、年中無休で 24 時間 363 日 (クリスマス イブとクリスマスを除く)、4 日シフトで稼働しています。各乗組員は 4 日連続で 12 時間勤務し、その後 4 日間休みます。4 人のクルーがいて、それぞれ 4 日働いて 4 日休み、4 夜働いて 4 夜休みです。A クルーと B クルーは互いに反対に回転し、C クルーと D クルーは互いに反対に回転します。
A クルーと B クルーが作業している間、A または B クルーの誰かが欠席した場合に備えて、C クルーと D クルーのメンバーが待機しています。従業員には、シニア オペレーター、ジュニア オペレーター、コンパウンダーの 3 つの分類があります。各乗組員には、4 人のシニア オペレーター、3 人のジュニア オペレーター、および 2 人のコンパウンダーがいます。4 日間のローテーション サイクルの最初の 2 日間は、シニア オペレーターの 3 人がオンコールで、4 人目がオンコールではありません。この期間に当直していないシニア オペレータがローテーションします。最後の 2 日間は、3 人のジュニア オペレーターが待機しています。
上級従業員の場合、前のサイクルによって、日勤か夜勤かが決まります。勤務していないクルーが日勤だった場合、シニア オペレーターは最初の 2 日勤の勤務中、またはその逆です。前のサイクルで夜勤をしていた場合。ジュニア オペレータの場合、これから開始するサイクルによって、次の 2 日間の休みが日勤か夜勤かが決まります。
コンパウンダーは、1 日目と 4 日目の休日に待機しています。昼夜問わず、オペレーターと同様に判断されます。
私の目標は、Java でプログラムを作成して、昼と夜のシフトごとに待機中の従業員を計算し、その結果をテキスト ファイルに出力することです。私はこれまでにプログラミングのクラスを 2 つしか受けていないアマチュアです。出力が正しくない理由を理解しようとしています。私の疑いは、変数の計算が間違っているか、パズルのピースが完全に欠けていることです。1 日と 2 日は前年のサイクルの一部であったため、プログラムの目的上、年の最初の日は 1 月 3 日であることに注意してください。
以下は私のコードです。割り当てられた長さに収まるように、すべてのゲッターとセッターを削除しました。提供できるすべてのヘルプに感謝します。
import java.io.File;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Scanner;
public class OnCallAug812 {
Calendar cal1 = Calendar.getInstance();
private double cycleDay = ((cal1.get(Calendar.DAY_OF_YEAR) - 3)) % 16;
private double dayOfCycle = cycleDay % 4;
// number of days into current rotation ( 0 =4, 1=1, 2=2, 3=3)
private int cycleRotation = (int) (cycleDay / 4);
// number of current rotation (4 per cycle)
private int cycleOfYear = ((cal1.get(Calendar.DAY_OF_YEAR) - 3) / 16);
private int onCallCycle = cycleOfYear % 4;
// A crew operators: 4 Senior
private int a1S = 0;
private int a2S = 1;
private int a3S = 2;
private int a4S = 3;
// variables for A crew names
private String a1;
private String a2;
private String a3;
private String a4;
// A Crew Junior Operators represented by one variable b/c
// all are on call or not on call at same time
private int aJr;
// A crew junior operator names
private String aJr1;
private String aJr2;
private String aJr3;
// B crew operators: 4 Senior
private int b1S = 0;
private int b2S = 1;
private int b3S = 2;
private int b4S = 3;
// B crew operator names
private String b1;
private String b2;
private String b3;
private String b4;
// B Crew Junior Operators represented by one variable b/c
// all are on call or not on call at same time
private int bJr;
// B crew operator junior names
private String bJr1;
private String bJr2;
private String bJr3;
// C crew operators: 4 Senior
private int c1S = 0;
private int c2S = 1;
private int c3S = 2;
private int c4S = 3;
// C operator senior names
private String c1;
private String c2;
private String c3;
private String c4;
// C Crew Junior Operators represented by one variable b/c
// all are on call or not on call at same time
private int cJr;
// C crew junior operator names
private String cJr1;
private String cJr2;
private String cJr3;
// D crew operators: 4 Senior
private int d1S = 0;
private int d2S = 1;
private int d3S = 2;
private int d4S = 3;
// d crew senior names
private String d1;
private String d2;
private String d3;
private String d4;
// D Crew Junior Operators represented by one variable b/c
// all are on call or not on call at same time
private int dJr;
// D crew junior operator names
private String dJr1;
private String dJr2;
private String dJr3;
// Call status for each A Crew employee--set to 0,1, or 2
// 0 = on call day shift
// 1 = on call night shift
// 2 = off call
private int a1SCallStat = -1;
private int a2SCallStat = -1;
private int a3SCallStat = -1;
private int a4SCallStat = -1;
private int aJrCallStat = -1;
// Call status for each B Crew employee--set to 0,1, or 2
private int b1SCallStat = -1;
private int b2SCallStat = -1;
private int b3SCallStat = -1;
private int b4SCallStat = -1;
private int bJrCallStat = -1;
// Call status for each C Crew employee--set to 0,1, or 2
private int c1SCallStat = -1;
private int c2SCallStat = -1;
private int c3SCallStat = -1;
private int c4SCallStat = -1;
private int cJrCallStat = -1;
// Call status for each D Crew employee--set to 0,1, or 2
private int d1SCallStat = -1;
private int d2SCallStat = -1;
private int d3SCallStat = -1;
private int d4SCallStat = -1;
private int dJrCallStat = -1;
// Call status for each crew's pelletizer operators (both on or both off)
private int aP;
private int bP;
private int cP;
private int dP;
private String aP1;
private String aP2;
private String bP1;
private String bP2;
private String cP1;
private String cP2;
private String dP1;
private String dP2;
private int aPCallStat = -1;
private int bPCallStat = -1;
private int cPCallStat = -1;
private int dPCallStat = -1;
public int determineCall(double onCallCycle, int crewNumber) {
double aNumber = (crewNumber + onCallCycle) % 7;
if (aNumber <= 2) {
return 0;
} else if (aNumber >= 3 && aNumber < 6) {
return 1;
} else if (aNumber == 6) {
return 2;
} else
return -1;
}
public int determineCallJr(double onCallCycle, int crewNumber){
double aNumber = (crewNumber + onCallCycle) % 7;
if (aNumber <= 3) {
return 0;
} else if (aNumber >= 4 && aNumber <= 6) {
return 1;
} else
return -1;
}
public int determineCallP(double onCallCycle, int crewNumber){
double aNumber = (crewNumber + onCallCycle) % 7;
if (aNumber <= 3) {
return 0;
} else if (aNumber >= 4 && aNumber <= 6) {
return 1;
} else
return -1;
}
public void calcCall(OnCallAug812 aug1) {
// Senior employees on call checks
if ((aug1.cycleRotation == 0)
&& ((aug1.dayOfCycle == 1) || (aug1.dayOfCycle == 0))) {
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC1S()) == 0) {
aug1.setC1SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC1S()) == 1) {
aug1.setC1SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC1S()) == 2) {
aug1.setC1SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC2S()) == 0) {
aug1.setC2SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC2S()) == 1) {
aug1.setC2SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC2S()) == 2) {
aug1.setC2SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC3S()) == 0) {
aug1.setC3SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC3S()) == 1) {
aug1.setC3SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC3S()) == 2) {
aug1.setC3SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC4S()) == 0) {
aug1.setC4SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC4S()) == 1) {
aug1.setC4SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC4S()) == 2) {
aug1.setC4SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD1S()) == 0) {
aug1.setD1SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD1S()) == 1) {
aug1.setD1SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD1S()) == 2) {
aug1.setD1SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD2S()) == 0) {
aug1.setD2SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD2S()) == 1) {
aug1.setD2SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD2S()) == 2) {
aug1.setD2SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD3S()) == 0) {
aug1.setD3SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD3S()) == 1) {
aug1.setD3SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD3S()) == 2) {
aug1.setD3SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD4S()) == 0) {
aug1.setD4SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD4S()) == 1) {
aug1.setD4SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD4S()) == 2) {
aug1.setD4SCallStat(2);
}
}
if ((aug1.cycleRotation == 1)
&& ((aug1.dayOfCycle == 1) || (aug1.dayOfCycle == 0))) {
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA1S()) == 0) {
aug1.setA1SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA1S()) == 1) {
aug1.setA1SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA1S()) == 2) {
aug1.setA1SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA2S()) == 0) {
aug1.setA2SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA2S()) == 1) {
aug1.setA2SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA2S()) == 2) {
aug1.setA2SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA3S()) == 0) {
aug1.setA3SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA3S()) == 1) {
aug1.setA3SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA3S()) == 2) {
aug1.setA3SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA4S()) == 0) {
aug1.setA4SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA4S()) == 1) {
aug1.setA4SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA4S()) == 2) {
aug1.setA4SCallStat(2);
}
// b crew second rotation
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB1S()) == 0) {
aug1.setB1SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB1S()) == 1) {
aug1.setB1SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB1S()) == 2) {
aug1.setB1SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB2S()) == 0) {
aug1.setB2SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB2S()) == 1) {
aug1.setB2SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB2S()) == 2) {
aug1.setB2SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB3S()) == 0) {
aug1.setB3SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB3S()) == 1) {
aug1.setB3SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB3S()) == 2) {
aug1.setB3SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB4S()) == 0) {
aug1.setB4SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB4S()) == 1) {
aug1.setB4SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB4S()) == 2) {
aug1.setB4SCallStat(2);
}
}
if ((aug1.cycleRotation == 2)
&& ((aug1.dayOfCycle == 1) || (aug1.dayOfCycle == 0))) {
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC1S()) == 0) {
aug1.setC1SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC1S()) == 1) {
aug1.setC1SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC1S()) == 2) {
aug1.setC1SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC2S()) == 0) {
aug1.setC2SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC2S()) == 1) {
aug1.setC2SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC2S()) == 2) {
aug1.setC2SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC3S()) == 0) {
aug1.setC3SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC3S()) == 1) {
aug1.setC3SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC3S()) == 2) {
aug1.setC3SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC4S()) == 0) {
aug1.setC4SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC4S()) == 1) {
aug1.setC4SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getC4S()) == 2) {
aug1.setC4SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD1S()) == 0) {
aug1.setD1SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD1S()) == 1) {
aug1.setD1SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD1S()) == 2) {
aug1.setD1SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD2S()) == 0) {
aug1.setD2SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD2S()) == 1) {
aug1.setD2SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD2S()) == 2) {
aug1.setD2SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD3S()) == 0) {
aug1.setD3SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD3S()) == 1) {
aug1.setD3SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD3S()) == 2) {
aug1.setD3SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD4S()) == 0) {
aug1.setD4SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD4S()) == 1) {
aug1.setD4SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getD4S()) == 2) {
aug1.setD4SCallStat(2);
}
}
if ((aug1.cycleRotation == 3)
&& ((aug1.dayOfCycle == 1) || (aug1.dayOfCycle == 0))) {
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA1S()) == 0) {
aug1.setA1SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA1S()) == 1) {
aug1.setA1SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA1S()) == 2) {
aug1.setA1SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA2S()) == 0) {
aug1.setA2SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA2S()) == 1) {
aug1.setA2SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA2S()) == 2) {
aug1.setA2SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA3S()) == 0) {
aug1.setA3SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA3S()) == 1) {
aug1.setA3SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA3S()) == 2) {
aug1.setA3SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA4S()) == 0) {
aug1.setA4SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA4S()) == 1) {
aug1.setA4SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getA4S()) == 2) {
aug1.setA4SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB1S()) == 0) {
aug1.setB1SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB1S()) == 1) {
aug1.setB1SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB1S()) == 2) {
aug1.setB1SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB2S()) == 0) {
aug1.setB2SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB2S()) == 1) {
aug1.setB2SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB2S()) == 2) {
aug1.setB2SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB3S()) == 0) {
aug1.setB3SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB3S()) == 1) {
aug1.setB3SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB3S()) == 2) {
aug1.setB3SCallStat(2);
}
if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB4S()) == 0) {
aug1.setB4SCallStat(0);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB4S()) == 1) {
aug1.setB4SCallStat(1);
} else if (aug1.determineCall(aug1.getOnCallCycle(), aug1.getB4S()) == 2) {
aug1.setB4SCallStat(2);
}
}
// Junior Extruder Operators
if ((aug1.cycleRotation == 0)
&& ((aug1.dayOfCycle == 3) || (aug1.dayOfCycle == 2))) {
if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getcJr()) == 0) {
aug1.setcJrCallStat(0);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getcJr()) == 1) {
aug1.setcJrCallStat(1);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getcJr()) == 2) {
aug1.setcJrCallStat(2);
}
if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getdJr()) == 0) {
aug1.setDjrCallStat(1);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getdJr()) == 1) {
aug1.setDjrCallStat(0);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getdJr()) == 2) {
aug1.setDjrCallStat(2);
}
}
if ((aug1.cycleRotation == 1)
&& ((aug1.dayOfCycle == 3) || (aug1.dayOfCycle == 2))) {
if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getaJr()) == 0) {
aug1.setaJrCallStat(0);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getaJr()) == 1) {
aug1.setaJrCallStat(1);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getaJr()) == 2) {
aug1.setaJrCallStat(2);
}
if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getbJr()) == 0) {
aug1.setbJrCallStat(1);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getbJr()) == 1) {
aug1.setbJrCallStat(0);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getbJr()) == 2) {
aug1.setbJrCallStat(2);
}
}
if ((aug1.cycleRotation == 2)
&& ((aug1.dayOfCycle == 3) || (aug1.dayOfCycle == 2))) {
if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getcJr()) == 0) {
aug1.setcJrCallStat(0);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getcJr()) == 1) {
aug1.setcJrCallStat(1);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getcJr()) == 2) {
aug1.setcJrCallStat(2);
}
if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getdJr()) == 0) {
aug1.setDjrCallStat(1);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getdJr()) == 1) {
aug1.setDjrCallStat(0);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getdJr()) == 2) {
aug1.setDjrCallStat(2);
}
}
if ((aug1.cycleRotation == 3)
&& ((aug1.dayOfCycle == 3) || (aug1.dayOfCycle == 2))) {
if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getaJr()) == 0) {
aug1.setaJrCallStat(0);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getaJr()) == 1) {
aug1.setaJrCallStat(1);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getaJr()) == 2) {
aug1.setaJrCallStat(2);
}
if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getbJr()) == 0) {
aug1.setbJrCallStat(1);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getbJr()) == 1) {
aug1.setbJrCallStat(0);
} else if (aug1.determineCallJr(aug1.getOnCallCycle(), aug1.getbJr()) == 2) {
aug1.setbJrCallStat(2);
}
}
if ((aug1.cycleRotation == 0)
&& ((aug1.dayOfCycle == 3) || (aug1.dayOfCycle == 0))) {
if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getcP()) == 0) {
aug1.setcPCallStat(0);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getcP()) == 1) {
aug1.setcPCallStat(1);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getcP()) == 2) {
aug1.setcPCallStat(2);
}
if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getdP()) == 0) {
aug1.setdPCallStat(1);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getdP()) == 1) {
aug1.setdPCallStat(0);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getdP()) == 2) {
aug1.setdPCallStat(2);
}
}
if ((aug1.cycleRotation == 1)
&& ((aug1.dayOfCycle == 3) || (aug1.dayOfCycle == 0))) {
if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getaP()) == 0) {
aug1.setaPCallStat(0);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getaP()) == 1) {
aug1.setaPCallStat(1);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getaP()) == 2) {
aug1.setaPCallStat(2);
}
if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getbP()) == 0) {
aug1.setbPCallStat(1);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getbP()) == 1) {
aug1.setbPCallStat(0);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getbP()) == 2) {
aug1.setbPCallStat(2);
}
}
if ((aug1.cycleRotation == 2)
&& ((aug1.dayOfCycle == 3) || (aug1.dayOfCycle == 0))) {
if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getcP()) == 0) {
aug1.setcPCallStat(1);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getcP()) == 1) {
aug1.setcPCallStat(0);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getcP()) == 2) {
aug1.setcPCallStat(2);
}
if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getdP()) == 0) {
aug1.setdPCallStat(0);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getdP()) == 1) {
aug1.setdPCallStat(1);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getdP()) == 2) {
aug1.setdPCallStat(2);
}
}
if ((aug1.cycleRotation == 3)
&& ((aug1.dayOfCycle == 3) || (aug1.dayOfCycle == 0))) {
if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getaP()) == 0) {
aug1.setaPCallStat(1);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getaP()) == 1) {
aug1.setaPCallStat(0);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getaP()) == 2) {
aug1.setaPCallStat(2);
}
if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getbP()) == 0) {
aug1.setbPCallStat(0);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getbP()) == 1) {
aug1.setbPCallStat(1);
} else if (aug1.determineCallP(aug1.getOnCallCycle(), aug1.getbP()) == 2) {
aug1.setbPCallStat(2);
}
}
}
private String readFile(String pathname) throws Exception {
File file = new File(pathname);
StringBuilder fileContents = new StringBuilder((int) file.length());
Scanner scanner = new Scanner(file);
String lineSeparator = System.getProperty("line.separator");
try {
while (scanner.hasNextLine()) {
fileContents.append(scanner.nextLine() + lineSeparator);
}
return fileContents.toString();
} finally {
scanner.close();
}
}
public void check0(PrintWriter output2, int callStat, String name) {
if (callStat == 0) {
output2.print(name);
output2.println();
}
}
public void check1(PrintWriter output2, int callStat, String name) {
if (callStat == 1) {
output2.print(name);
output2.println();
}
}
public void addDate(OnCallAug812 aug1) {
cal1.add(Calendar.DATE, 1);
aug1.cycleDay = ((cal1.get(Calendar.DAY_OF_YEAR) - 3)) % 16;
aug1.dayOfCycle = cycleDay % 4;
// number of days into current rotation ( 0 =4, 1=1, 2=2, 3=3)
aug1.cycleRotation = (int) (cycleDay / 4);
// number of current rotation (4 per cycle)
aug1.cycleOfYear = ((cal1.get(Calendar.DAY_OF_YEAR) - 2) / 16);
aug1.onCallCycle = cycleOfYear % 4;
}
public static void main(String[] args) throws Exception {
OnCallAug812 aug1 = new OnCallAug812();
aug1.calcCall(aug1);
System.out.print("Day of 16 day rotation(0 to 15): ");
System.out.println(aug1.cycleDay);
System.out.print("Day of 4 day cycle (0 to 3): ");
System.out.println(aug1.dayOfCycle);
System.out.print("Cycle of 16 day rotation (0 to 3): ");
System.out.println(aug1.cycleRotation);
System.out.print("16 day cycle number (0 to 22): ");
System.out.println(aug1.cycleOfYear);
System.out.print("On Call Cycle Number(0 to 6 then repeat): ");
System.out.println(aug1.onCallCycle);
}
public OnCallAug812() {
super();
}
}