Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

sched.dat set DAYS := Mon Tue Wed Thu Fri Sat Sun ; set PLANS := SaSu SuMo MoTu

ID: 671844 • Letter: S

Question

sched.dat

set DAYS := Mon Tue Wed Thu Fri Sat Sun ;

set PLANS := SaSu SuMo MoTu TuWe WeTh ThFr FrSa ;

param need := Mon 16 Tue 11 Wed 17 Thu 13

Fri 15 Sat 19 Sun 14 ;

param sched: SaSu SuMo MoTu TuWe WeTh ThFr FrSa :=

Mon 1 0 0 1 1 1 1   

Tue 1 1 0 0 1 1 1   

Wed 1 1 1 0 0 1 1   

Thu 1 1 1 1 0 0 1   

Fri 1 1 1 1 1 0 0   

Sat 0 1 1 1 1 1 0   

Sun 0 0 1 1 1 1 1 ;

sched.mod

set DAYS ordered;
set PLANS ordered;

param need {DAYS} > 0;

param sched {DAYS,PLANS} binary;

var Work {PLANS} >= 0;

minimize Employees: sum {p in PLANS} Work[p];

subj to MeetNeed {d in DAYS}:
sum {p in PLANS} sched[d,p] * Work[p] >= need[d];

2A chain of fast-foodestaants operates 7 days a week, and has the following daily requirements for kitchen employees Minimam uraber of employees required Day 3 Wednesday 17 5 Friday 6 Saturday 15 19 14 Each employee is schedaled to work a stretch of ive conseeutive days, such as Monday thagh Friday, Tuesday throagh Saturday, or Friday though Tuesday The management wants to know how many employees shoald be assigned each schedale, so that the requirements are satisfied on every day, and the total mumber of employees is as small as possible. You have seen how a variation on the minimam-cost input model can be om lated for situations of this kind. First we define two underlying sets, one of days (corresponding to outputs) and one of work plans (corresponding to inputs): set PLANS Next we define the numbers that igure in the model. Certainly, there are the numbers of employees needed, one number for each day. In AMPL we repeesent these by declaring a parameter seed indexed over the set DAYS: paran need (DAYS>0 We also require some way to describe the work plans. For this parpose we declare a table of nu nbers sched indexed over all combinations of DAYS and PLANS: paras sched (DAYS,PLANS) Binary For any combination of a member d of DAYS and a member p of PLANS, there exists an entry schedd,pl: the keyword binary in the declaration specifies that each entry must be either a0ora1. We interpret these entries as follows If sched ld,pi, then people following plan pst work on day d If sched ld,pis, then people following plan p dont wokon day d Using these data delinitions, the rest of the AMPL model delines the following variables, objective and constraints: rar Work (PLANS) >. 0; sininize Esployees:sun (p in PLANS) Work[p): ubj to Neet eed din DATS You may find the example given in the class to be belpful with this question, althoagh the situation there is somewhat different a: The key to this formalation is the use of the table sched in describing the constraints. Give a brief explanation of why the oonstraints, as written in the AMPL model, guarantee that the solution will provide enough employees on each day. Your explanation shoukd make a good comment to put in the model so that another analyst would understand it be To solve a particular linear progranm using this AMPL model, it is necessary to supply partieular data values. In the case of the requirements and work plans specified at the beginning of this problem, the appropeiate data can be represented in AMPL. as follows: set DAYS-Moa Tue Wed Tau Fri Sat Su Paras need:Mon 16 Tu 11 Wed 17 Thu 13 Fri 15 Sat 19 Sun 14 Mon 11 Tue 01 Wed 01 Thu 1 1 1 Fri 1o Sun 11 The complete AMPL model and data are posted with this assignment in the fiks sched.mod and sched1.dat. Ran AMPL, using any linear programming solver, to get an optimal solution In your solution, many employees follow each work plan? e: Your solution in (b) unfortunately requires fractional sumbers of people to work some days. To get an implementable solution that still meets the staffing constraints, you can round each fractional variable up to the next-highest whole number In the rounded-ap solution, which work schedules should be used, and how many emploees shoakd Sollow each? How many employees are used in total? d: To get the best possible whole-aumber solution, change your AMPL model so that all the variables are declared to be integer-valued ar Work CPLANS integer 0 Save your modiied model in sched2.mod. Now switch (if necessary) to a solver (such as CPLEX) that can handle integrality restrictions, and compute a new solbatlon for the combinatlon of sehed2.nod and sched1.dat In the optimal whole-aumber solution, which work scbedules should be used and how many employees should follow each? How many employees are used in total? State in a sentence or two how this optimal solution differs fron the rounded solution in (e) e: By typing display need, MeetNeed.body; you can get a table from AMPL that shows for each day the umber of employees beeded and the umber actually working. On which days is the number working greater than the namber needed, and by how mch? f To rule out solutions that use "extra" employees, you might change thein the MeetNeed constraint to be-. Solve with this revision in the model and with the same data. Explain in a Sew sentences what results yon get and what they tell you about the problem g: You can use AMPL. to compute the following number spi: display ceil (sua (d i DAYS? eed(d) / 5); The fanction ceil rounds a mamber up to the next highest integer.) Explain in words why this namber is a lower bound on the total namber of employees required, assuming that every employee will work & days of each week. What is the di rence between the actual number of employees Bed in your solution in (d) and this lower bound? h: By experimenting with various possibilities, find one or more additional five day work plans that, when appended to the data in (d), give a solution that achieves the lower bound. (The days off in the additional work plans ull not be consentire.) How does the resulting solution differ from the one in (d)? You can use sched2.nod for the model in this part, bat you'll eed to modify the data file. Store the new data file in sched2.dat.

Explanation / Answer

i think your requirement like this...

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 % 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();
}
}