Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Java by tgeorge ( 6 years ago )
/**
* This will tell the user wheather they will be in school or not on a specific day
* @tgeorge
* @10/9/20
*/
import java.util.Scanner;
public class Cohort
{
public static void main(String [] args)
{
Scanner in=new Scanner(System.in);
System.out.println("Please enter your assigned Cohort");
String cohort=in.nextLine();
System.out.println("What day of the week is it?");
String day=in.nextLine();
boolean isCohortA;
boolean isCohortB;
boolean isCohortC;
boolean isCohortAB;
boolean isMonTues;
boolean isWed;
boolean isThursFri;
boolean isWeekend;
if(cohort.equalsIgnoreCase("A"))
{
isCohortA=true;
isCohortB=false;
isCohortC=false;
isCohortAB=false;
if (day.equalsIgnoreCase("Monday") || day.equalsIgnoreCase("Tuesday"))
{
isMonTues=true;
isWed=false;
isThursFri=false;
isWeekend=false;
if(isCohortA&&isMonTues)
{
System.out.println("You are in school");
}
}
else
{
System.out.print("You are home");
}
}
else if(cohort.equalsIgnoreCase("B"))
{
isCohortA=false;
isCohortB=true;
isCohortC=false;
isCohortAB=false;
if(day.equalsIgnoreCase("Thursday") || day.equalsIgnoreCase("Friday"))
{
isMonTues=false;
isWed=false;
isThursFri=true;
isWeekend=false;
if(isCohortB&&isThursFri)
{
System.out.println("You are in school");
}
}
else
{
System.out.println("You are home");
}
}
else if(cohort.equalsIgnoreCase("C"))
{
isCohortA=false;
isCohortB=false;
isCohortC=true;
isCohortAB=false;
if(isCohortC)
{
System.out.println("You are home");
}
}
else if(cohort.equalsIgnoreCase("AB"))
{
isCohortA=false;
isCohortB=false;
isCohortC=false;
isCohortAB=true;
if(day.equalsIgnoreCase("Saturday")||day.equalsIgnoreCase("Sunday")||day.equalsIgnoreCase("Wednesday"))
{
isMonTues=false;
isWed=false;
isThursFri=false;
isWeekend=true;
if(isCohortAB&&isWeekend)
{
System.out.println("You are at home");
}
}
else
{
System.out.println("You are in school");
}
}
else
{
System.out.println("Somethings off with your Cohort");
}
}
}
Revise this Paste
Children: 112358