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
- Download and install Java Development Kit (JDK) 8.
- Download and install IntelliJ IDEA 14 (Community Edition).
Details
The following program asks the user for the number of hours worked per week, the number of weeks of vacation per year, and his/her hourly wage. The program calculates the total amount that the user will earn in a year.
/* * Course: SE-1011 * Term: Fall 2014 * Assignment: Lab 1 * Author: Dr. Chris Taylor * Date: 09/14/09 * Modified: 08/09/14 - updated for Fall 2014 */ package taylor; import java.util.Scanner; /** * Class containing the entire program for lab 1 in fall 2014 * SE-1011 course. * @author taylor * @version 2014-08-09-1.4 */ public class Lab1 { /** * Simple program to calculate the amount of money a user * will earn in one year. * @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 hours worked per week: "); int hoursWorked = in.nextInt(); System.out.print("Enter the number of weeks of vacation taken: "); int vacationWeeks = in.nextInt(); System.out.print("Enter your hourly wage (in dollars): "); double hourlyWage = in.nextDouble(); // Calculate earnings double yearlyEarnings = hoursWorked * (52 - vacationWeeks) * hourlyWage; System.out.println("You will earn $" + yearlyEarnings + " in one year."); } }
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. Demonstrate to your instructor that you can compile and run the program.
Lab Deliverables (due at the end of week 1 lab)
Each student must demonstrate compiling and running the program on their laptop.
Deliverables
Make sure you follow the submission instructions for YOUR instructor.
Acknowledgement
This laboratory assignment was developed by Dr. Chris Taylor.