流程以退出代码1

时间:2019-05-04 08:31:23

标签: intellij-idea

我刚开始与intellij合作,并且遇到一个问题,即我的谷歌搜索没有给我真正解决问题的解决方案。我收到错误代码:

  

以退出代码1完成的过程

对于发布全部代码感到很抱歉,但是我不知道它可能在哪里搞乱了,因为我无法运行调试器。

我从网上下载了一个JDK(我的研究似乎告诉我这将有助于解决它),但是整个应用程序对我来说似乎是超级陌生的,我不确定如何正确启动它,因此我实际上可以尝试调试代码/设置应用程序。

package com.company;

import java.util.Scanner;
public class Main()
{
    Scanner user_input = new Scanner(System.in);
    public static void main(String[] args)
    {
        System.out.println("Enter the days for your class followed by hitting enter.");
        System.out.println("Ex: Monday, Wednesday = M W");
        System.out.println("Ex: Teusday, Thursday = T R");
        System.out.println("Ex: Monday, Tuesday, Wednesday, Thursday = M T W R");
        String days = reader.next;
        reader.close;

        System.out.println("Enter the time your class starts in 2400 format followed by hitting enter.");
        System.out.println("Ex: 7:30 AM = 730");
        System.out.println("Ex: 1:15 PM = 1315");
        System.out.println("Ex: 4:00 PM = 1600");
        int time = reader.next;
        reader.close;

        if(days == "M" || "T" || "W" || "R" || "F" || "S") //only one day of class
        {
            if(days == "M")//only Monday
            {
                if(time >= 800 && time <= 930){
                    System.out.println("Your final is Monday from 8:00 am to 10:00 am");
                }
                else if(time >= 1115 && time <= 1245){
                    System.out.println("Your final is Monday from 11:00 am to 1:00 pm");
                }
                else if(time >= 1300 && time <= 1600){
                    System.out.println("Your final is Monday from 2:00 pm to 4:00 pm");
                }
                else if(time >= 1630){
                    System.out.println("Your final is on Monday starting at your regular class time.");
                }
            }
            else if(days == "T") //only Tuesday
            {
                if (time >= 800 && time <= 930) {
                    System.out.println("Your final is Tuesday from 8:00 am to 10:00 am");
                }
                else if (time >= 1115 && time <= 1245) {
                    System.out.println("Your final is Tuesday from 11:00 am to 1:00 pm");
                }
                else if (time >= 1300 && time <= 1600) {
                    System.out.println("Your final is Tuesday from 2:00 pm to 4:00 pm");
                }
                else if(time >= 1630){
                    System.out.println("Your final is on Tuesday starting at your regular class time.");
                }
            }
            else if(days == "W") //only Wednesday
            {
                if (time >= 800 && time <= 930) {
                    System.out.println("Your final is Wednesday from 8:00 am to 10:00 am");
                }
                else if (time >= 1115 && time <= 1245) {
                    System.out.println("Your final is Wednesday from 11:00 am to 1:00 pm");
                }
                else if (time >= 1300 && time <= 1600) {
                    System.out.println("Your final is Wednesday from 2:00 pm to 4:00 pm");
                }
                else if(time >= 1630){
                    System.out.println("Your final is on Wednesday starting at your regular class time.");
                }
            }
            else if(days == "R") //only Thursday
            {
                if (time >= 800 && time <= 930) {
                    System.out.println("Your final is Thursday from 8:00 am to 10:00 am");
                }
                else if (time >= 1115 && time <= 1245) {
                    System.out.println("Your final is Thursday from 11:00 am to 1:00 pm");
                }
                else if (time >= 1300 && time <= 1600) {
                    System.out.println("Your final is Thursday from 2:00 pm to 4:00 pm");
                }
                else if(time >= 1630){
                    System.out.println("Your final is on Thursday starting at your regular class time.");
                }
            }
            else if(days == "F"){
                System.out.println("Your final is on Friday starting at your regular class time.");
            }
            else if(days == "S"){
                System.out.println("Your final is on Saturday starting at your regular class time.");
            }
        }
        else if(days == "M W" || "M W F" || "M T W R" )
        {
            if(time >= 700 && time <= 830) {
                System.out.println("Your final is Monday from 8:00 am to 10:00 am");
            }
            else if(time >= 900 && time <= 1030) {
                System.out.println("Your final is Wednesday from 8:00 am to 10:00 am");
            }
            else if(time >= 1100 && time <= 1130) {
                System.out.println("Your final is Monday from 11:00 am to 1:00 pm");
            }
            else if(time >= 1230 && time <= 1300) {
                System.out.println("Your final is Wednesday from 11:00 am to 1:00 pm");
            }
            else if(time >= 1400 && time <= 1440) {
                System.out.println("Your final is Monday from 2:00 pm to 4:00 pm");
            }
            else if(time >= 1500 && time <= 1545) {
                System.out.println("Your final is Wednesday from 2:00 pm to 4:00 pm");
            }
            else if(time >= 1630){
                System.out.println("Your final is Monday starting at your regular class time");
            }
        }
        else if(days == "T W" || "T R" || "T W R" || "T R F" || "T W R F") //Second 3 lines on schedule
        {
            if (time >= 700 && time <= 830) {
                System.out.println("Your final is Tuesday from 8:00 am to 10:00 am");
            }
            else if(time >= 900 && time <= 1030) {
                System.out.println("Your final is Thursday from 8:00 am to 10:00 am");
            }
            else if (time >= 1100 && time <= 1130) {
                System.out.println("Your final is Tuesday from 11:00 am to 1:00 pm");
            }
            else if(time >= 1230 && time <= 1300) {
                System.out.println("Your final is Thursday from 11:00 am to 1:00 pm");
            }
            else if (time >= 1400 && time <= 1440) {
                System.out.println("Your final is Tuesday from 2:00 pm to 4:00 pm");
            }
            else if(time >= 1500 && time <= 1545) {
                System.out.println("Your final is Thursday from 2:00 pm to 4:00 pm");
            }
            else if(time >= 1630){
                System.out.println("Your final is Tuesday starting at your regular class time");
            }
        }
        else if(days == "W F"){
            if(time == 800) {
                System.out.println("Your final is Friday from 8:00 am to 10:00 am");
            }
            else if(time == 1100){
                System.out.println("Your final is Friday from 11:00 am to 1:00 pm");
            }
            else if(time >= 1630){
                System.out.println("Your final is Friday starting at your regular class time");
            }
        }
        else if(string == "F S"){
            System.out.println("Your final is Saturday starting at your regular class time");
        }

    }
    return 0;
}

预期结果应该会弹出一个文本框,允许用户输入一系列字符和军事时间,以为他们提供该班级决赛所需的正确时间和日期。

0 个答案:

没有答案