


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Lab; Class: Java Programming 1 - Introduction; Subject: Computer Science; University: Middlesex County College; Term: Forever 1989;
Typology: Lab Reports
1 / 4
This page cannot be seen from the preview
Don't miss anything!
Be able to write an algorithm Create a Java program template Be able to enter and compile a Java program using Text Pad Document a program using Word
1. TextPad We will be using Textpad as our editor. Open Textpad by clicking on the icon on the desktop. Familiarize yourself with the menu. Make sure you are familiar with the standard word functions such as copy, paste, search and replace. Menu options that are specific to Java are: /view/line numbers, /tools/external tools/compile java and tools/external tools/Run Java application. Locate these menu items we will use them later. To make things easier: Select View and select Line numbers and visible spaces (you’ll have to do this each time you start TextPad). 2. Snipping Tool (Start/Programs/Accessories) The snipping tool allows you to cut and paste portions of the screen. Click on the snipping tool icon on the desktop. Click and drag the cursor over the portion you want to copy. Select Edit/Copy or Right Click/Copy. Open word and click paste. To start again click on the New button. 3. Payroll Algorithm; a) Write an algorithm to calculate an employees pay. The employee gets 1. times the hourly rate for more than 40 hrs. b) Pick a few examples and manually calculate the result. This will be used to verify that the program is working. Enter the results in the table below. Hours Rate Pay (hand calculated) Pay (program result)
4. Java Template. Using Textpad enter the following code and save it as Template.java. DO NOT save to hard drive, use a USB Drive. // Your Name // Lab Number // Description of Lab public class Template { public static void main (String[] args) { } } 5. Enter the following program: (Pay.java) (start with template.java, rename it and edit it). Must enter exactly as shown below, including blank lines, spaces, upper/lower case. // Your name // Lab 1 //This program calculates the user's gross pay import java.util.Scanner; //to be able to read from the keyboard public class Pay { public static void main(String [ ] args) { //create a Scanner object to read from the keyboard Scanner keyboard = new Scanner(System.in); //identifier declarations double hours; //number of hours worked double rate; //hourly pay rate double pay; //gross pay //display prompts and get input System.out.println(“Name”); System.out.println(“Lab 1”); System.out.print("How many hours did you work? "); hours = keyboard.nextDouble(); System.out.print("How much do you get paid per hour? "); rate = keyboard.nextDouble();