This assessment item is designed to test your understanding of variables, constants, types, operators, standard console input/output, loops, if statements, classes, objects and methods.
For this assignment, you are required to develop a Java Console Program to demonstrate that you can use Java constructs including input/output via a command line, Java primitive and built-in data types, Java defined objects, selection and looping statements, methods, and various other Java commands. Your program must produce the correct results.
You are only allowed to use techniques which have been covered in the first six weeks of the course, you must use the Scanner object for input and no advanced data structures like arrays should be used. Instructions for this appear in the implementation section of this specification.
What to submit for this assignment
The Java source code: Pay.java
A report including a flow chart to depict your program (main method), how long it took to create, any problems encountered and screen shots of the output produced. (Use Alt-PrtScrn to capture just the console window and you can paste it into your Word document) You should test every possibility in the program. ReportAss1.docx
The management of a fast food store in Rockhampton has asked you to write a java program to help calculating and recording the wage of its employees. This application should also produces some statistics.
You are to write a Java Console Application (Pay.java) which will allow users to enter the details of N employees including their name, skill level (which is defined as level 1, 2 and 3), and the number of hours they work for a week. N should be equal to the highest digit in your student ID, use N=3 if your highest digit is less than three. For each employee the program will prompt for accepting the employee name, skill level and the length of worked hours (in whole number). It will then display the wage that the employee should receive (see sample output below for formatting details). The standard rates of wage depend on the skill levels, which are set as $15, $17 and $21 per hour for levels 1, 2, and 3 respectively, while the employee will be paid at one and one-half times the usual rate for any hours over 40. The wage is simply computed by multiplying the number of worked hours with the hourly rate and you may account for the over-time pay if the employee works more than 40 hours.
The required Java Console Application should allow the user to:
1. Enter the name, skill level, and the length of worked hours (in whole number) for each of the N employees. The program then will compute and output the wage for this employee. All dollar values will be formatted to two decimal places (see implementation below with help for doing this). It assumes that when the program is running, the user will correctly enter either 1, 2 or 3 for employee skill level, no other digit entered. The program will number each employee in the input prompt.
2. Show relevant statistical information after N employees have been entered and related computations have been completed. You will output a heading for the statistics Statistical information & bar chart, the minimum and maximum wage with the corresponding name of the employee, and the average wage (formatted to two decimal places. see sample output below) and finally a simple bar chart to indicate how many employees to work in a specific length interval. Note: if more than one employee has an equal maximum or minimum wage you just need to only output one of the employees name.
3. Display a welcome message at the beginning Welcome to use the General Wage Record System and an end message e.g. Thank you for using the General Wage Record System and the final line Program written by < your student ID > (see sample output below).
The numeric literal values N, and the standard wage rates, etc. must be represented as constants.
A number of students have never written a program before so this is a fairly simple assignment which can be written in the main method of your class Pay.java. Alternatively, you can define a class with suitable individual methods and then create an object in a driver program (a test class) with calling the methods defined. Either way of implementations is acceptable. Follow the steps outlined here (writing all codes in the main method) and build your program up in a step by step fashion and always compile your program at each stage so you are always working on error free code.
Start by creating your Pay.java class which will contain just the main method, COMPILE! (Fix any errors and repeat)
Implement the welcome message, COMPILE and RUN!
Declare your Scanner object(s), COMPILE!
Note: In order to combat the problem of the Scanner objects reading both textual and numeric data, a good way to counter this is to declare two Scanner objects, one for reading text and another for reading numbers.
Declare variables to hold the employee name, skill level and the length of worked hours etc. (String, int and int), COMPILE!
You may need to declare other variables such as wage to hold the relevant data etc.
Create a loop to loop N Times, COMPILE! (use N = 3 for development) Within the loop: prompt and read the employees name and skill level, COMPILE and RUN! Add the prompt and read for the length of worked hours, COMPILE and RUN!
Calculate the wage with the consideration of over-time working if the employee works more than 40 hours, COMPILE, RUN and TEST until this is correct. Output the description of the transaction (see sample output below) Output all dollar values to two decimal places: USE: System.out.printf(%.2f, wage);
Use if statements to determine if the employee wage is maximum or minimum, (you will have to think about this). Output the minimum and maximums after the loop for testing, COMPILE and RUN until you have this correct. You may want to set your initial max and min variables to a small number and very large numbers such as using 0 and Double.MAX_VALUE.
You will need to add up the wage as you go so you can calculate the average.
After the loop you will output the statistics which you have gathered in the loop. You should have the maximum and minimum wage and the corresponding employee name as well as the average pay. In addition, proper counts should be set for recording the number of employee with worked hours in a specific length interval. You can use System.out.print(+) within a loop to display the bar chart. Alternatively, you may use the string concatenation to complete this task.
Output the statistics as indicated in the screen shot below.
Finally print the end message.
Your program should be well laid out, commented and uses appropriate and consistent names (camel notation) for all variables and objects.
For this assignment you will not worry about checking numeric ranges.
Refer to a Java reference textbook and the course and lecture material (available on the course Web site) for further information about the Java programming topics required to complete this assignment.
Check the marking guide (last page) to ensure you have completed every task. You need to match the output as shown below.
A typical screen shot of the program executing with the input of five employees (one by one) is shown in next page. see image.