Inspiration

I was inspired to design a program that enables people of any age to figure out whether they are diagnosed with COVID-19, the flu or season allergies. This was inspired by my personal experiences, as somebody who was never able to tell the differences between the symptoms.

What it does

My program inputs a user's answer to whether they have a symptom, 'add' up their responses, and ultimately come up with a final response.

How we built it

Using switch statements to get multiple-choice, I was able to have the program add up each response, and at the end, an if statement compared the total responses and gave an appropriate answer.

Challenges we ran into

Being able to display this on a website makes it more UI-friendly. Unfortunately, we didn't have the time, as we had worked 1-7:30 at our part-time job, and had zero knowledge of CSS and HTML.

Accomplishments that we're proud of

Being able to finish this project in under 2 hours (This is including the attempt in creating an HTML website).

What we learned

Switch statements, and comparisons.

What's next for Hackathon - Illness Check

import java.util.Scanner;

public class illnessQuiz {
    static String choice;
    static int count1;
    static int count2;
    static int count3;
    static int count4;
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        count1 = 0;
        count2 = 0;
        count3 = 0;
        count4 = 0;
        System.out.println("How would you describe the frequency of your symptons?");
        System.out.println("Do you cough? Usually, sometimes, rarely, or never?");
        choice = sc.nextLine();
        choice = choice.toLowerCase();
        switch (choice) {
        case "usually":
            System.out.println("You usually cough.");
            count1 = count1 + 1;
            break;
        case "sometimes":
            System.out.println("You sometimes cough.");
            count2 = count2 + 1;
            break;
        case "rarely":
            System.out.println("You rarely cough.");
            count3 = count3 + 1;
            break;
        case "never":
            System.out.println("You never cough.");
            count4 = count4 + 1;
            break;
        }
        System.out.println("How often in the day are you tired? Usually, sometimes, rarely, or never?");
        choice = sc.nextLine();
        choice = choice.toLowerCase();
        switch (choice) {
        case "usually":
            System.out.println("You usually are tired.");
            count1 = count1 + 1;
            break;
        case "sometimes":
            System.out.println("You sometimes are tired.");
            count2 = count2 + 1;
            break;
        case "rarely":
            System.out.println("You rarely are tired.");
            count3 = count3 + 1;
            break;
        case "never":
            System.out.println("You never are tired.");
            count4 = count4 + 1;
            break;
        }
        System.out.println("How often do you feel a sore throat? Usually, sometimes, rarely, or never?");
        choice = sc.nextLine();
        choice = choice.toLowerCase();

        switch (choice) {
        case "usually":
            System.out.println("You usually have a sore throat.");
            count1 = count1 + 1;
            break;
        case "sometimes":
            System.out.println("You sometimes have a sore throat.");
            count2 = count2 + 1;
            break;
        case "rarely":
            System.out.println("You rarely have a sore throat.");
            count3 = count3 + 1;
            break;
        case "never":
            System.out.println("You never have a sore throat.");
            count4 = count4 + 1;
            break;
        }
        System.out.println("How often do you sneeze? Usually, sometimes, rarely, or never?");
        choice = sc.nextLine();
        choice = choice.toLowerCase();
        switch (choice) {
        case "usually":
            System.out.println("You usually sneeze.");
            count1 = count1 + 1;
            break;
        case "sometimes":
            System.out.println("You sometimes sneeze.");
            count2 = count2 + 1;
            break;
        case "rarely":
            System.out.println("You rarely sneeze.");
            count3 = count3 + 1;
            break;
        case "never":
            System.out.println("You never sneeze.");
            count4 = count4 + 1;
            break;
        }
        System.out.println("How often do you feel a runny nose? Usually, sometimes, rarely, or never?");
        choice = sc.nextLine();
        choice = choice.toLowerCase();
        switch (choice) {
        case "usually":
            System.out.println("You usually sneeze.");
            count1 = count1 + 1;
            break;
        case "sometimes":
            System.out.println("You sometimes sneeze.");
            count2 = count2 + 1;
            break;
        case "rarely":
            System.out.println("You rarely sneeze.");
            count3 = count3 + 1;
            break;
        case "never":
            System.out.println("You never sneeze.");
            count4 = count4 + 1;
            break;
        }
        if (count1 >= 3 && count2 >= 2) {
            System.out.println("You could possibly have COVID-19.");
        }
        else if (count2 >= 3 || count1 <= 2) {
            System.out.println("You could possibly have a flu or cold.");
        }
        else if (count3 >= 3 && count4 >= 2) {
            System.out.println("You could possibly have a cold or seasonal allergies.");
        }
        else if (count4 >= 3 && count3 <= 2) {
            System.out.println("You are not ill!");
        }
    }
}

Built With

Share this project:

Updates