Overview

The purpose of this assignment is to ensure that all students are able to create, compile, and run Java programs within the IntelliJ IDEA Integrated Development Environment (IDE).

Prerequisites

Part I

The following program asks the user for the number of credits s/he is taking and the number of hours s/he plans to study each week. The program calculates the recommended number of hours to study based on the number of credits and compares that to the student's plan.

/* 
 * Course: CS-1011
 * Fall 2021
 * Lab 1 - First Program
 * Name: Dr. Chris Taylor
 * Created: 09/02/21
 */
package taylor;

import java.util.Scanner;

/**
 * Class containing the entire program for lab 1 in Fall 2021 CS-1011 course. 
 * @author taylor
 * @version 2021-09-02
 */
public class StudyTime {

    /**
     * Simple program to determine help set study expectations for a new
     * college student.
     * @param args ignored
     */
    public static void main(String[] args) {
        // Create a "reference variable"/object to gather data
        // from the keyboard
        Scanner in = new Scanner(System.in);
        
        // Request data from the user
        System.out.print("Enter the number of credits you are taking this term: ");
        int creditsTaken = in.nextInt();
        System.out.print("Enter the number of hours you plan to spend studying each week: ");
        int plannedHours = in.nextInt();

        // Calculate recommended hours of study
        int recommendedHoursLow = creditsTaken * 2;
        int recommendedHoursHigh = creditsTaken * 3;

        System.out.println("You are taking " + creditsTaken 
                 + " credits this term and plan to study " + plannedHours 
                 + " hours per week.");

        System.out.print("You plan to study ");
        if(plannedHours < recommendedHoursLow) {
            System.out.print("less than");
        } else if(plannedHours > recommendedHoursHigh) {
            System.out.print("more than");
        } else {
            System.out.print("in the range of");
        }
        System.out.println(" the recommended " + recommendedHoursLow + " - "
                 + recommendedHoursHigh + " hours per week.");

    }

}

Follow along as your instructor demonstrates how to create a project, package, and class in IntelliJ. Then paste the above code into the text editor window of IntelliJ.

Part II

Once you have successfully compiled and run the program, create a new class called TruthsAndLie and write a program that displays two true statements about yourself and one lie about yourself. The program you write should be much less complicated than the sample program above since you will not require user input or do any calculations. Note: your program should just print the three statements. It should not identify which statements are true and which statement is a lie.

Select a partner (or be assigned one by your instructor), introduce yourselves and demonstrate your working programs. If you need help getting your program to work, ask your partner for help. If your partner needs help getting his/her program to work, assist them. Once both of your programs compile and run successfully, have your partner guess which of your statements is a lie.

Record both of your names and indicate how many guesses it took to guess the lie. For example, if Jane Dough and Jon Doh were partners and Jon guessed Jane's lie on the first guess and Jane guessed Jon's lie on the second guess, your paper should look something like this:

NameNumber of guesses
Jane Dough2 guesses
Jon Doh1 guess

Acknowledgement

This laboratory assignment was developed by Dr. Chris Taylor.

Lab Deliverables (due at the end of week 1 lab)

Make sure you follow any additional requirements and submission instructions for YOUR instructor.