Welcome, guest! Login / Register - Why register?
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 paigethorn ( 5 years ago )
/**
 * This program asks the user 2 questions.
 * 1. What day of the week is it?
 * 2. What time of the day is it?(assume in military time)
 * 
 * The program will then state what period it is in the current SHS schedule. (assuming school is in session)
 * If it is not in sessio, just print school is not in session"
 * 
 * @paigethorn
 * 3/19/21
 */

import java.util.Scanner;

public class WhatBlock
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        System.out.println("What day of the week is it?");
        String day = in.nextLine();
        System.out.println("What time of the day is it in military time");
        int time = in.nextInt();
        System.out.println("What day rotation is it?");
        String rotation = in.nextLine();
        
        if(day.equals("Monday")|| day.equals ("Tuesday") || day.equals ("Wednesday") || day.equals ("Thursday") || day.equals ("Friday"))
        {
            System.out.println("School is in session!");
            {
                if(time <= 815 && time >= 923)
                {
                    System.out.println("It is A Block");
                }
                if(time <= 924 && time >= 1036)
                {
                    System.out.println("It is B Block");
                }
                if(time <= 1037 && time >= 1149)
                {
                    System.out.println("It is C Block");
                }
                if(time <= 1150 && time >= 1333)
                {
                    System.out.println("It is G Block");
                }
                if(time <= 1334 && time >= 1446)
                {
                    System.out.println("It is F Block");
                }
                if(time > 815 || time < 1446)
                {
                    System.out.println("School is over or hasn't started yet");
                }
            }
        }
        if(day.equals("Saturday") || day.equals ("Sunday"))
        {
            System.out.println("School is not in session!");
        }
        
    }
}

 

Revise this Paste

Your Name: Code Language: