Type of paper: Essay

Topic: Expression, Workplace, Java, Loop, Employee, System, Evaluation, Value

Pages: 2

Words: 550

Published: 2020/10/13

New WowEssays Premium Database!

Find the biggest directory of over
1 million paper examples!

I work part time at a local supermarket, and we are 100 employees. The supermarket has a HR system that stores all the records of the employees. There are different categories of employees at the supermarket. Some work full time while others work part time. Others are permanently employed while others work on contractual basis. The salary scale of the employees differs according to their employment status. Each employee can log into the HR system to check out the details of their pay. The system also enables the employees to apply for off duties and leave days.
The HR system is a Java application that has been developed using the Java programming language. The program needs a while loop statement so as to generate the pay slips of the employees automatically. Currently the data that is fed into the program is entered individually for all the employees, and yet their salaries are proportional to one another. The individual entry of every employee detail is tedious, time wasting, and creates more room for mistakes. The Java while loop statements will limit the shortcomings of the current HR program.
The Java while loop statements enable the codes to be performed repeatedly based on the set condition. The loop statements act by evaluating the written expressions that returns either a true or false value. The true or false values are known as Boolean (Lowe, 2015). A true value prompts the system to continue evaluating the expression until it gets a false value. The Java while statement creates a loop that continues to act for as long as the condition of the expression remains true. The syntax of the expression is as shown below.

statement
The Java while loop statement starts with the evaluation of the expression. A true statement will lead to the execution of the statement. The expression is placed under evaluation again repeating the entire process. A false expression results in the lack of execution of the expression, and the loop is ended (Lowe, 2015).
There are four job levels of the permanent employees and they include clerks, supervisors, assistant managers, and managers. The clerks are paid $2000; supervisors $4000; assistant managers $6000; and managers $8000. A logical expression that can be used to print the salaries of the permanent employees is shown below.
int number = 2000;
while (number <= 8000)
{
System.out.print (number + “ “);
}

The result of running the above expression is as shown below:

2000 4000 6000 8000
The condition in this expression is: number <= 8000. The meaning is that the Java while loop will keep repeating itself for as long as the result is less than or equal to 8000. The loop contains two statements that serve different purposes. The first statement enables the printing of the value of the number separating it from the next number using a space (Lowe, 2015). The second statement enables the addition of 2000 to the previous number. The Java while loop statement I have used is counter-controlled because I already know that the statement will be evaluated 4 times given the four permanent employee levels.

Another way of writing down the expression for purposes of evaluation is as shown below:

boolean found = false;
while (!found)
{
System.out.print (number + “ “);
if (number = 10000)
found = true;
}
The above expression used the flag-controlled while loop (Reges & Stepp, 2008). It changes the program because the Java while loop statement will keep evaluating the expression until it finds the red flag which is valued at 10000. The expression will not be executed once the red flag has been detected.

References

Reges, S. & Stepp, M. (2008). Building Java Programs: A Back to Basics Approach. Boston: Addison Wesley.
Lowe, D. (2015). How to Use While Statements in Java. Retrieved from: http://www.dummies.com/how-to/content/how-to-use-while-statements-in-java.html

Cite this page
Choose cite format:
  • APA
  • MLA
  • Harvard
  • Vancouver
  • Chicago
  • ASA
  • IEEE
  • AMA
WePapers. (2020, October, 13) While (Expression) Essay Sample. Retrieved September 27, 2021, from https://www.wepapers.com/samples/while-expression-essay-sample/
"While (Expression) Essay Sample." WePapers, 13 Oct. 2020, https://www.wepapers.com/samples/while-expression-essay-sample/. Accessed 27 September 2021.
WePapers. 2020. While (Expression) Essay Sample., viewed September 27 2021, <https://www.wepapers.com/samples/while-expression-essay-sample/>
WePapers. While (Expression) Essay Sample. [Internet]. October 2020. [Accessed September 27, 2021]. Available from: https://www.wepapers.com/samples/while-expression-essay-sample/
"While (Expression) Essay Sample." WePapers, Oct 13, 2020. Accessed September 27, 2021. https://www.wepapers.com/samples/while-expression-essay-sample/
WePapers. 2020. "While (Expression) Essay Sample." Free Essay Examples - WePapers.com. Retrieved September 27, 2021. (https://www.wepapers.com/samples/while-expression-essay-sample/).
"While (Expression) Essay Sample," Free Essay Examples - WePapers.com, 13-Oct-2020. [Online]. Available: https://www.wepapers.com/samples/while-expression-essay-sample/. [Accessed: 27-Sep-2021].
While (Expression) Essay Sample. Free Essay Examples - WePapers.com. https://www.wepapers.com/samples/while-expression-essay-sample/. Published Oct 13, 2020. Accessed September 27, 2021.
Copy

Share with friends using:

Please remember that this paper is open-access and other students can use it too.

If you need an original paper created exclusively for you, hire one of our brilliant writers!

GET UNIQUE PAPER
Related Premium Essays
Contact us
Chat now