Lab 1
Start Now
## 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](http://www.jetbrains.com/idea/) Integrated Development Environment (IDE). ### Prerequisites * Download and install [Java 8 JDK (Java Development Kit) from Amazon (called Amazon Corretto 8)](https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/windows-7-install.html) (select the .msi file of the Windows x64 JDK). * Download and install [IntelliJ IDEA](http://www.jetbrains.com/idea/download/index.html). The Community Edition is all you'll need for this course, but you can download the Ultimate Edition and create a [free student account](https://www.jetbrains.com/student/), if you'd like. ## 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-011 * Fall 2019 * Lab 1 - First Program * Name: Dr. Chris Taylor * Created: 08/22/19 */ package taylor; import java.util.Scanner; /** * Class containing the entire program for lab 1 in Fall 2019 CS-1011 course. * @author taylor * @version 2019-08-22 */ 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, 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. Write both of your names on a sheet of paper 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: <table> <tr><th>Name</th><th>Number of guesses</th></tr> <tr><td>Jane Dough</td><td>2 guesses</td></tr> <tr><td>Jon Doh</td><td>1 guess</td></tr> </table> ## Acknowledgement This laboratory assignment was developed by [Dr. Chris Taylor](/taylor/). ## Lab Deliverables (due at the end of week 1 lab) <div class="notetip">Submit the sheet of paper to your instructor. Make sure you follow any additional requirements and submission instructions for __YOUR__ instructor. </div>

Wednesday, 04-Sep-2019 06:08:46 CDT