ICS 111, Introduction to Computer Science
Lab 8 -
Instructions:
To receive credit for this lab assignment, you must be finished by
Friday, February 18, at 11:59 p.m. After this time you will not receive any credit. Future lab assignments will be due by 11:59 p.m. on the day of the lab assignment.1. Log in to UH UNIX (Secure Shell in Windows) or (Putty) and create a Java file in Pico that fulfills the following requirements:
Write a Java program that will calculate the pay for the week before.
- Ask the user for the following information
* employee name
* employee pay per hour
* hours worked
- If the employee has worked 40 hours or less the pay will be calculated by multiplying pay per hour by hours worked.
- If the employee worked over 40 hours, the first 40 hours will be calculated as described the previous step.
- The pay of the hours over 40 will be calculated as hours over 40 multiplied by pay and a half.
- As an example: if the employee makes $10 per hour every hour over 40 will earn him $15.
- The program should validate the employee name by making sure that it contains at least two non-blank characters. (hint: use trim and length) at this point we cannot verify that the employee's name is actually a valid name so for now two non-blank characters will suffice.
- When the user enters the hours worked, you should make sure that the number of hours is not negative. The number cannot be any number over 100 (100 is ok)
- The pay per hour should be between 6 and 20 dollars per hour.
- When reading information from the user, if any information is invalid the program should terminate.
- You can gracefully terminate a program using the instruction
System.exit(0);
But if you do not use it, you will get extra credit in your first midterm.You need to write comments using the JAVA coding standard - failure to do so will result in up to a 30% deduction from your score.
2. Get into Pine (Getting Started with Pine, PDF) and send an email with the file attached to ics111-lab@hawaii.edu account.
- Your e-mail should have the following subject: lab X / lastname (substitute the lab number for 'X', and lastname should be substituted for your lastname) Not following this standard will result in a deduction of points.
3. Check the webpage to make sure that the e-mail arrived at
http://www2.hawaii.edu/~tp_200/bmf/ics111-lab.html