SlideShare a Scribd company logo
maJavaProjectFinalExam/.classpath
maJavaProjectFinalExam/.project
maJavaProjectFinalExam
org.eclipse.jdt.core.javabuilder
org.eclipse.jdt.core.javanature
maJavaProjectFinalExam/bin/maJavaProjectFinalExam/Employe
e.classpackage maJavaProjectFinalExam;
publicsynchronizedclass Employee {
public String firstName;
public String lastName;
public String empStatus;
public double hoursWorked;
public double hourlyRate;
public double grossPay;
public double fedTaxes;
public double stateTaxes;
public double netPay;
publicstatic java.util.ArrayList employeeList;
static void <clinit>();
public void Employee();
public void Employee(String, String, String, double);
public void Employee(String, String, String, double, double);
publicstatic double calcGrossPay(Employee);
publicstatic double calcFedTaxes(Employee);
publicstatic double calcStateTaxes(Employee);
publicstatic double calcNetPay(Employee);
publicstatic String getFirstName(Employee);
publicstatic String getLastName(Employee);
publicstatic String getFullName(Employee);
publicstatic String getEmpStatus(Employee);
publicstatic double getHoursWorked(Employee);
publicstatic double getHourlyRate(Employee);
publicstatic double getGrossPay(Employee);
publicstatic double getFedTaxes(Employee);
publicstatic double getStateTaxes(Employee);
publicstatic double getNetPay(Employee);
publicstatic void getEmployeeByLastName(String);
}
maJavaProjectFinalExam/bin/maJavaProjectFinalExam/Employe
eDriver$1.classpackage maJavaProjectFinalExam;
synchronizedclass EmployeeDriver$1 implements
java.util.Comparator {
void EmployeeDriver$1();
public int compare(Object, Object);
}
maJavaProjectFinalExam/bin/maJavaProjectFinalExam/Employe
eDriver.classpackage maJavaProjectFinalExam;
publicsynchronizedclass EmployeeDriver {
public void EmployeeDriver();
publicstatic void main(String[]);
publicstatic void sortEmployee(java.util.ArrayList);
publicstatic void printEmployeeDetails();
publicstatic String convertDoubletoCurreny(double);
}
maJavaProjectFinalExam/src/maJavaProjectFinalExam/Employe
e.javamaJavaProjectFinalExam/src/maJavaProjectFinalExam/Em
ployee.javapackage maJavaProjectFinalExam;
/*{*******************************************
* Student Name : Moajep Alagaleen
* Course Name: Programming Fundamentals
* Course Id:CS219DN
* JavaProjectFinalExam
********************************************}*/
/*{
* Purpose of Program:
*
* prgram used to store the values and returns the values when e
ver the other class requested
* this program contains all the variables
*
* }*/
import java.util.ArrayList;
publicclassEmployee{
publicString firstName;//store the first name of employee
publicString lastName;//Store the last name of employee
publicString empStatus;//store the employee status
publicdouble hoursWorked;//store the no. of hours worked by e
mployee
publicdouble hourlyRate;//store the hourly rate of employee
publicdouble grossPay;//store the gross pay of employee
publicdouble fedTaxes;//store the fed of student
publicdouble stateTaxes;//Store the state taxes of employee
publicdouble netPay;//stores the net pay of employee
publicstaticArrayList<Employee> employeeList=newArrayList<
Employee>();//Store the list of all employee's in class
publicEmployee()//default constructor
{
}
//Constructor to populate the employee details in employee obje
ct and add it to class list
publicEmployee(String firstName,String lastName,String empSt
atus,double hourlyRate)
{
Employee employeeDetails=newEmployee();//Create a new emp
loyee object and populate values read from user
employeeDetails.firstName=firstName;//Initializing the em
ployeeDetails firstName variable
employeeDetails.lastName=lastName;//Initializing the emp
loyeeDetails lastName variable
employeeDetails.empStatus="Exempt";//Initializing the em
ployeeDetails empStatus variable
employeeDetails.hoursWorked=40.00;//Initializing the em
ployeeDetails hoursWorked variable
employeeDetails.hourlyRate=hourlyRate;//Initializing the
employeeDetails hourlyRate variable
employeeDetails.grossPay=calcGrossPay(employeeDetails
);//Call the getGrossPay method to calculate the gross pay
employeeDetails.fedTaxes=calcFedTaxes(employeeDetails
);//Call the getFedTaxes method to calculate the federal taxes
employeeDetails.stateTaxes=calcStateTaxes(employeeDeta
ils);//Call the getStateTaxes method to calculate the state taxes
employeeDetails.netPay=calcNetPay(employeeDetails);//C
all the getNetPay method to calculate the net pay
employeeList.add(employeeDetails);//Add the employee o
bject to class details employeeList
}
//Constructor to populate the employee details in employee obje
ct and add it to class list
publicEmployee(String firstName,String lastName,String empSt
atus,double hoursWorked,double hourlyRate)
{
Employee employeeDetails=newEmployee();//Create a new emp
loyee object and populate values read from user
employeeDetails.firstName=firstName;//Initializing the em
ployeeDetails firstName variable
employeeDetails.lastName=lastName;//Initializing the emp
loyeeDetails lastName variable
employeeDetails.empStatus="Non-
Exempt";//Initializing the employeeDetails empStatus variable
employeeDetails.hoursWorked=hoursWorked;//Initializing
the employeeDetails hoursWorked variable
employeeDetails.hourlyRate=hourlyRate;//Initializing the
employeeDetails hourlyRate variable
employeeDetails.grossPay=calcGrossPay(employeeDetails
);//Call the getGrossPay method to calculate the gross pay
employeeDetails.fedTaxes=calcFedTaxes(employeeDetails
);//Call the getFedTaxes method to calculate the federal taxes
employeeDetails.stateTaxes=calcStateTaxes(employeeDeta
ils);//Call the getStateTaxes method to calculate the state taxes
employeeDetails.netPay=calcNetPay(employeeDetails);//C
all the getNetPay method to calculate the net pay
employeeList.add(employeeDetails);//Add the employee o
bject to class details employeeList
}
//this method to calculate the grossPay
publicstaticdouble calcGrossPay(Employee employeeDetails)
{
if(employeeDetails.hoursWorked>40.00)//if employee hours wor
ked is more than 40
return(40*employeeDetails.hourlyRate)+((employeeDetails.hour
sWorked-
40.00)*employeeDetails.hourlyRate*1.5);//calulating gross pay,
1.5 times to the hours more than 40
else
return(employeeDetails.hoursWorked*employeeDetails.hourlyR
ate);//grosspay is calculated by hoursworked*hourlyrate
}
//this methos to calculate the fedTaxes
publicstaticdouble calcFedTaxes(Employee employeeDetails)
{
return(employeeDetails.grossPay*15)/100;//fedTaxes is the 15%
of the grossPay
}
//this method to calculate the stateTaxes
publicstaticdouble calcStateTaxes(Employee employeeDetails)
{
return(employeeDetails.grossPay*6)/100;//stateTaxes is the 6%
of the grossPay
}
//this method to calculate the netPay
publicstaticdouble calcNetPay(Employee employeeDetails)
{
return(employeeDetails.grossPay-employeeDetails.fedTaxes-
employeeDetails.stateTaxes);//netPay is the minus of fedTaxes a
nd stateTaxes from grossPay
}
//this method to return the employee first name
publicstaticString getFirstName(Employee employeeDetails)
{
return employeeDetails.firstName;
}
//this method to return the employee last name
publicstaticString getLastName(Employee employeeDetails)
{
return employeeDetails.lastName;
}
//this method to return the employee full name
publicstaticString getFullName(Employee employeeDetails)
{
return employeeDetails.firstName+" "+employeeDetails.lastNa
me;
}
//this method to return the employee status
publicstaticString getEmpStatus(Employee employeeDetails)
{
return employeeDetails.empStatus;
}
//this method to return the employee hours worked
publicstaticdouble getHoursWorked(Employee employeeDetails
)
{
return employeeDetails.hoursWorked;
}
//this method to return the employee hourly rate
publicstaticdouble getHourlyRate(Employee employeeDetails)
{
return employeeDetails.hourlyRate;
}
//this method to return the employee gross pay
publicstaticdouble getGrossPay(Employee employeeDetails)
{
return employeeDetails.grossPay;
}
//this method to return the employee fed taxes
publicstaticdouble getFedTaxes(Employee employeeDetails)
{
return employeeDetails.fedTaxes;
}
//this method to return the employee state taxes
publicstaticdouble getStateTaxes(Employee employeeDetails)
{
return employeeDetails.stateTaxes;
}
//this method to return the employee net pay
publicstaticdouble getNetPay(Employee employeeDetails)
{
return employeeDetails.netPay;
}
//This method is to display the employee by lastName
publicstaticvoid getEmployeeByLastName(String lastName)
{
//checking whether the array has elements are not
if(employeeList.size()<=0)//if there are no elements in the array
, displaying the output
{
System.out.println(lastName+" was not found.");
}
else//array has elements then goes to search
{
//Use a loop to traverse through all the employee's in the list
//index is a loop variable used to print
int matchCount=0;//stores the no. of matches
for(int index=0;index<employeeList.size();index++)
{
//Take each object in the array list into a currentEmployee objec
t and print the details
Employee currentEmployee=employeeList.get(index);
if(lastName.equals(currentEmployee.lastName))//comparing the
inputed lastName with the employee lastName
{
System.out.println(currentEmployee.lastName+" was found in "
+currentEmployee.firstName+" "+currentEmployee.lastName);
matchCount++;
}
}
if(matchCount<=0)//if zero matches, then displaying the output
System.out.println(lastName+" was not found.");
}
}
}
maJavaProjectFinalExam/src/maJavaProjectFinalExam/Employe
eDriver.javamaJavaProjectFinalExam/src/maJavaProjectFinalEx
am/EmployeeDriver.javapackage maJavaProjectFinalExam;
/*{*******************************************
* Student Name : Moajep Alagaleen
* Course Name: Programming Fundamentals
* Course Id:CS219DN
* JavaProjectFinalExam
********************************************}*/
/*{**************************************************
*
* Purpose of program
*
* This program is used to read Employee details like first name
, last name, employee status,
* no. of hours worked and hourly rate to calculate gross pay,net
pay
* This program also prints the report of all the empoyee's.
* This is achieved by displaying a menu to user and allowing hi
m to choose an option
*
}*/
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Locale;
import java.util.Scanner;
publicclassEmployeeDriver{
//main method
publicstaticvoid main(String[] args){
Scanner inputReader=newScanner(System.in);//inputReader obj
ect to read data from user
int choice=0;//choice stores the menu option entered by user
String firstName, lastName,empStatus;//lastName stores the last
name of employee, firstName stores the first name of employee
, empStatus stores the employee status
double hoursWorked,hourlyRate;//hoursWorked to store the no.
of hours worked by employee, hourlyRate stores the hourly pay
of a employee
while(true)//Repeatedly allow the user to make choice until exit
is chosen
{
//Print the menu
System.out.println("nEmployee Menu");
System.out.println("---------------");
System.out.println();
System.out.println("1) Input an employee's information");
System.out.println("2) Find an employee by last Name");
System.out.println("3) Display employee payroll information -
sorted by last name");
System.out.println("4) Exit");
System.out.println();
System.out.print("Input menu choice: ");
try{
//Read the input from user
choice=Integer.parseInt(inputReader.nextLine());//
choice is a variable to take input from the user
if((choice>4)||(choice<1))thrownewNumberFormatException();//
If user enters a choice not in the list, throw exception
}
catch(NumberFormatException invalidInput)//Catch the excepti
on if user enters an input not in menu and invalidInput is a insta
nce for the exception
{
System.out.println("Invalid menu selection");//Print error messa
ge
}
switch(choice)//Based on the users choice, do the corresponding
tasks
{
case1://If the input is 1, read the employee details
System.out.print("Input the first name of the employee: ");
firstName=inputReader.nextLine();//Read the first
name of student
System.out.print("Input the last name of the employee: ");
lastName=inputReader.nextLine();//Read the last n
ame of student
while(true)//Read the employee status till a valid input is entere
d
{
System.out.print("Input 'E' for Exempt or 'N' for Non-
Exempt employee:");
try//check if user enters valid input
{
empStatus=inputReader.nextLine();//to read the e
mployee status
if(empStatus.equals("E"))//if user enters E then prompt the user
to enter hourly rate
{
while(true)//Repeatedly allow the user to make choice until exit
is chosen
{
System.out.print("Input the hourly rate:");//prompting to enter h
ourly rate
try{
hourlyRate=Double.parseDouble(inputReader
.nextLine());//converting the given data into double
if(hourlyRate<0)// if the user input is not numeric and negative
number throws an exception
thrownewNumberFormatException();//If the input is not betwee
n 0 and 100, throw an exception
else
break;
}
catch(NumberFormatException rateError)//ctach block to catch t
he exception
{
System.out.println("Input of hourly rate is invalid");//displaying
the error message
}
}
newEmployee(firstName,lastName,empStatus,hourlyRate);//calli
ng the constructor to add those details to employeeList
break;
}
elseif(empStatus.equals("N"))//if the user input equals to N
{
while(true)//Repeatedly allow the user to make choice until exit
is chosen
{
System.out.print("Input the hours worked:");//prompting user to
enter data
try{
hoursWorked=Double.parseDouble(inputRea
der.nextLine());//converting the given data to double
if(hoursWorked<0)// if the input is non numeric and negative va
lue then throws an exception
thrownewNumberFormatException();//If the input is not betwee
n 0 and 100, throw an exception
else
break;
}
catch(NumberFormatException rateError)//block to catch the ex
ception
{
System.out.print("Input of hours worked is invalid");//displayin
g the error message
}
}
while(true)//Repeatedly allow the user to make choice until exit
is chosen
{
System.out.print("Input the hourly rate:");//displying thr mesg t
o enter data
try{
hourlyRate=Double.parseDouble(inputReader
.nextLine());//converting the given data into double
if(hourlyRate<0)//if the input is non numeric and negative then t
hrows an exception
thrownewNumberFormatException();//If the input is not betwee
n 0 and 100, throw an exception
else
break;
}
catch(NumberFormatException rateError)//ctach block to catch t
he exception
{
System.out.println("Input of hourly rate is invalid");//displaying
the error message
}
}
newEmployee(firstName,lastName,empStatus,hoursWorked,hour
lyRate);//calling the Employee class consructor to store the data
in the employeeList
break;
}
else//if user enters other than E or N then throws an exception
thrownewException();
}
//catch the exception if the input is not valid
catch(Exception statusError)//block to catch the exception
{
System.out.println("Invalid input -
Employee status must be typed as a 'E' or 'N'");//displaying the
erroe message
}
}
break;
case2:
// prmpting the user to enter the lant name
System.out.print("Input the last name you wish to search on:");
lastName=inputReader.nextLine();
//calling the method to search the employee list by last name
Employee.getEmployeeByLastName(lastName);
break;
case3://Call the function to display the employee details
printEmployeeDetails();
break;
case4://Exit from the program
inputReader.close();
System.exit(0);
}
}
}
//This method to Sort the employee's by lastName and secondar
y sort by firstName
publicstaticvoid sortEmployee(ArrayList<?> employeeList)
{
//Use a loop to traverse through all the students in the list
//index is a loop variable used to sort
for(int index=0;index<employeeList.size();index++)
{
for(int index1=0;index1<employeeList.size();index1++)//index1
is a loop variable used to sort
{
Collections.sort(employeeList,newComparator<Object>(){// to s
ort the arrayList
publicint compare(Object o1,Object o2)//compare method to co
mpare the lastNames of students
{
Employee employee1=(Employee) o1;//declaring employee1 obj
ect for Employee class
Employee employee2=(Employee) o2;//declaring employee2 obj
ect for Employee class
int res=employee1.lastName.compareToIgnoreCase(employee2.l
astName);//res variable stores the compared result
if(res!=0)//if no two students lastNames are same
return res;
return employee1.firstName.compareToIgnoreCase(employee2.f
irstName);//if more than one employee lastName is same then c
ompare the firstName
}
});
}
}
}
//this method prints the employee details
publicstaticvoid printEmployeeDetails()
{
sortEmployee(Employee.employeeList);//Calling met
hod to sort the employee's by last name
try{
if(Employee.employeeList.size()<=0)//checking the condition w
hether the array contains elements
thrownewArrayIndexOutOfBoundsException();//throwing the ne
w exception
}
catch(ArrayIndexOutOfBoundsExceptionEmptyError)//EmptyEr
ror is a instance for ArrayIndexOfBoundsException class
//catch the exception if array contains no elements
{
System.out.println("No records have been inputted!");//displayi
ng the message
}
if(Employee.employeeList.size()>0)//checking the condition to
execute the block of code if it trues
{
//Print the header/ title of the table
System.out.println();
System.out.println("Employee Payroll Report");//Print the repor
t title
System.out.println("------------------------");
System.out.println();
System.out.print("Employee Name"+"tt");
System.out.print("Status"+"tt");
System.out.print("Hours Workedt");
System.out.print("Hourly Ratet");
System.out.print("Gross Payt");
System.out.print("Federal Taxest");
System.out.print("State Taxest");
System.out.print("Net Pay");
System.out.println("");
for(int index=1;index<=8;index++)//index is a loop variable use
d to print dash lines
{
if(index==5)
System.out.print("----------t");
elseif(index==3)
System.out.print("------------t");
elseif(index==4)
System.out.print("------------t");
elseif(index==1)
System.out.print("--------------tt");
elseif(index==2)
System.out.print("------tt");
elseif(index>=6&&index<=7)
System.out.print("-------------t");
else
System.out.print("-------t");
}
System.out.println("");
DecimalFormat dFormat=newDecimalFormat("#.00");//declaring
the dFormat variable to define the format
double totalGrossPay=0;//stores the totalGrossPay and initialize
s to zero
double totalFedTaxes=0;//stores the total federal taxes and initi
alizes to zero
double totalStateTaxes=0;//stores the total state taxes and initial
izes to zero
double totalNetPay=0;//stores the total net pay and initializes to
zero
//Use a loop to traverse through all the employee's in the list
for(int index=0;index<Employee.employeeList.size();index++)//
index is a loop variable used to print
{
//Take each object in the array list into a currentEmployee objec
t and print the details
Employee currentEmployee=Employee.employeeList.get(index);
System.out.print(currentEmployee.lastName+", "+currentEmplo
yee.firstName+"t");//print first name and last name
//If the characters in firstname and last name are less than 14, a
dd a tab space
if(currentEmployee.firstName.length()+currentEmployee.lastNa
me.length()<14)
System.out.print("t");
//If the characters in first name and last name are less than 6, ad
d another tab space
if(currentEmployee.firstName.length()+currentEmployee.lastNa
me.length()<6)
System.out.print("t");
System.out.print(currentEmployee.empStatus+" ");//prints the e
mployee status
if(currentEmployee.empStatus.length()<7)//if the statu length is
less than 7 then adds a one more tab
System.out.print("t");
if(currentEmployee.empStatus.length()<14)//if the statu length i
s less than 14 then adds a one more tab
System.out.print("t");
System.out.print(dFormat.format(currentEmployee.hoursWorke
d)+" t");//prints the hours worked by employee
System.out.print(dFormat.format(currentEmployee.hourlyRate)+
" tt");//prints the employee hourly rate
System.out.print(convertDoubletoCurreny(currentEmployee.gro
ssPay)+"t");//prints the gross pay of employee
if(convertDoubletoCurreny(currentEmployee.grossPay).length()
<=6)//if gross pay length is less than 6 than add a one more tab
System.out.print("t ");
System.out.print(convertDoubletoCurreny(currentEmployee.fed
Taxes)+"tt");//prints the federal taxes
System.out.print(convertDoubletoCurreny(currentEmployee.stat
eTaxes)+"tt");//prints the state taxes
System.out.print(convertDoubletoCurreny(currentEmployee.net
Pay)+"t");//prints the net pay
System.out.println("");
totalGrossPay=totalGrossPay+currentEmployee.gross
Pay;//calculating the total gross pay
totalFedTaxes=totalFedTaxes+currentEmployee.fedT
axes;//calculating the total federal taxes
totalStateTaxes=totalStateTaxes+currentEmployee.st
ateTaxes;//calculating the total state taxes
totalNetPay=totalNetPay+currentEmployee.netPay;//
calculating the total net pay
}
System.out.print("ttttttttt---------t----------t------------t--
-----");//printing the dashes
System.out.println("");
System.out.print("Totals:ttttttttt"+convertDoubletoCurren
y(totalGrossPay)+"t"+convertDoubletoCurreny(totalFedTaxes)
+"tt"+convertDoubletoCurreny(totalStateTaxes)+"tt"+convert
DoubletoCurreny(totalNetPay));//printing the total grosspay and
taxes net pay
}
}
publicstaticString convertDoubletoCurreny(doubleCurrencyAmo
unt)//method to convert the double to currency
{
DecimalFormat dFormat=newDecimalFormat("#.00");//declaring
the dFormat varible to define the format
String currencyString=dFormat.format(CurrencyAmount);//store
s the string format of double value
String[] currencyStringArray=currencyString.split(".");//splitti
ng the string at dot and storing them in the array
int currencyInteger=Integer.parseInt(currencyStringArray[0]);///
/storing the first part of the into the interger variable
String finalCurrencyString=(NumberFormat.getNumberInstance
(Locale.US).format(currencyInteger))+"."+currencyStringArray[
1];//converting the integer into currency format
return finalCurrencyString;//returning the final currency string
}
}

More Related Content

PDF
Create a C# applicationYou are to create a class object called “Em.pdf
PDF
package employeeType.employee;public class Employee {   private .pdf
PDF
Designing Immutability Data Flows in Ember
DOCX
import java.io.-WPS Office.docx
PDF
package employeeType.employee;public class Employee {    private.pdf
PDF
Program.cs class Program { static void Main(string[] args).pdf
PPTX
AngularJS - $http & $resource Services
PDF
Clean Javascript
Create a C# applicationYou are to create a class object called “Em.pdf
package employeeType.employee;public class Employee {   private .pdf
Designing Immutability Data Flows in Ember
import java.io.-WPS Office.docx
package employeeType.employee;public class Employee {    private.pdf
Program.cs class Program { static void Main(string[] args).pdf
AngularJS - $http & $resource Services
Clean Javascript

Similar to maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx (20)

PDF
Code Include libraries. import javax.swing.JOptionPane;.pdf
DOC
slides
PDF
Vehicle.javapublic class Vehicle {    Declaring instance var.pdf
PDF
package employeeType.employee;public abstract class Employee {  .pdf
PDF
HELP IN JAVACreate a main method and use these input files to tes.pdf
PPT
PHP Unit Testing
PDF
TypeScriptで書くAngularJS @ GDG神戸2014.8.23
PDF
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
PDF
Curso Symfony - Clase 2
PDF
Code moi une RH! (PHP tour 2017)
PDF
Doctrine For Beginners
PDF
Virtual Madness @ Etsy
PDF
Unittests für Dummies
DOCX
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
PDF
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
PDF
PDF
Pragmatic functional refactoring with java 8 (1)
PDF
Load Testing with PHP and RedLine13
PDF
Manual tecnic sergi_subirats
Code Include libraries. import javax.swing.JOptionPane;.pdf
slides
Vehicle.javapublic class Vehicle {    Declaring instance var.pdf
package employeeType.employee;public abstract class Employee {  .pdf
HELP IN JAVACreate a main method and use these input files to tes.pdf
PHP Unit Testing
TypeScriptで書くAngularJS @ GDG神戸2014.8.23
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
Curso Symfony - Clase 2
Code moi une RH! (PHP tour 2017)
Doctrine For Beginners
Virtual Madness @ Etsy
Unittests für Dummies
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
Pragmatic functional refactoring with java 8 (1)
Load Testing with PHP and RedLine13
Manual tecnic sergi_subirats

More from infantsuk (20)

DOCX
Please cite and include references- Broderick & Blewitt (2015) must.docx
DOCX
Please choose 1 of the 2 topics below for this weeks assignment.docx
DOCX
Please be advised that for the second writing assignment, the clas.docx
DOCX
Please briefly describe cross cultural variations in Consumer Beha.docx
DOCX
Please be sure to organize your report using section headers to clea.docx
DOCX
Please attach two different assignments. Please first provide the dr.docx
DOCX
Please answers some questions below (attached references)  1.Wh.docx
DOCX
Please answer these discussion questions thoroughly.  Provide re.docx
DOCX
Please click on this link and follow the directions to complete the .docx
DOCX
Please choose one of the following questions, and post your resp.docx
DOCX
Please answer the questions in paragraphs containing at least fi.docx
DOCX
Please answer the following three questions in one to two paragraphs.docx
DOCX
Please answer the following1.  Transformational leadership and .docx
DOCX
Please answer the below questionDescribe social bandwidth and s.docx
DOCX
Please answer the following questions1.- Please name the fu.docx
DOCX
Please answer the following questions1.- Please name the follow.docx
DOCX
Please answer the following questions with supporting examples and f.docx
DOCX
Please answer the following questions about air and water pollution .docx
DOCX
please answer the following 7 questions in its entirety.  #11.C.docx
DOCX
Please answer the questions listed below and submit in a word docume.docx
Please cite and include references- Broderick & Blewitt (2015) must.docx
Please choose 1 of the 2 topics below for this weeks assignment.docx
Please be advised that for the second writing assignment, the clas.docx
Please briefly describe cross cultural variations in Consumer Beha.docx
Please be sure to organize your report using section headers to clea.docx
Please attach two different assignments. Please first provide the dr.docx
Please answers some questions below (attached references)  1.Wh.docx
Please answer these discussion questions thoroughly.  Provide re.docx
Please click on this link and follow the directions to complete the .docx
Please choose one of the following questions, and post your resp.docx
Please answer the questions in paragraphs containing at least fi.docx
Please answer the following three questions in one to two paragraphs.docx
Please answer the following1.  Transformational leadership and .docx
Please answer the below questionDescribe social bandwidth and s.docx
Please answer the following questions1.- Please name the fu.docx
Please answer the following questions1.- Please name the follow.docx
Please answer the following questions with supporting examples and f.docx
Please answer the following questions about air and water pollution .docx
please answer the following 7 questions in its entirety.  #11.C.docx
Please answer the questions listed below and submit in a word docume.docx

Recently uploaded (20)

PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Classroom Observation Tools for Teachers
PPTX
Institutional Correction lecture only . . .
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Basic Mud Logging Guide for educational purpose
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Complications of Minimal Access Surgery at WLH
PDF
Pre independence Education in Inndia.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Cell Types and Its function , kingdom of life
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
master seminar digital applications in india
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
Microbial disease of the cardiovascular and lymphatic systems
GDM (1) (1).pptx small presentation for students
Classroom Observation Tools for Teachers
Institutional Correction lecture only . . .
Final Presentation General Medicine 03-08-2024.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
Basic Mud Logging Guide for educational purpose
human mycosis Human fungal infections are called human mycosis..pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Complications of Minimal Access Surgery at WLH
Pre independence Education in Inndia.pdf
Sports Quiz easy sports quiz sports quiz
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Cell Types and Its function , kingdom of life
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
master seminar digital applications in india
STATICS OF THE RIGID BODIES Hibbelers.pdf
O7-L3 Supply Chain Operations - ICLT Program

maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx

  • 1. maJavaProjectFinalExam/.classpath maJavaProjectFinalExam/.project maJavaProjectFinalExam org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature maJavaProjectFinalExam/bin/maJavaProjectFinalExam/Employe e.classpackage maJavaProjectFinalExam; publicsynchronizedclass Employee { public String firstName; public String lastName; public String empStatus; public double hoursWorked; public double hourlyRate; public double grossPay; public double fedTaxes; public double stateTaxes; public double netPay;
  • 2. publicstatic java.util.ArrayList employeeList; static void <clinit>(); public void Employee(); public void Employee(String, String, String, double); public void Employee(String, String, String, double, double); publicstatic double calcGrossPay(Employee); publicstatic double calcFedTaxes(Employee); publicstatic double calcStateTaxes(Employee); publicstatic double calcNetPay(Employee); publicstatic String getFirstName(Employee); publicstatic String getLastName(Employee); publicstatic String getFullName(Employee); publicstatic String getEmpStatus(Employee); publicstatic double getHoursWorked(Employee); publicstatic double getHourlyRate(Employee); publicstatic double getGrossPay(Employee); publicstatic double getFedTaxes(Employee); publicstatic double getStateTaxes(Employee); publicstatic double getNetPay(Employee); publicstatic void getEmployeeByLastName(String); } maJavaProjectFinalExam/bin/maJavaProjectFinalExam/Employe eDriver$1.classpackage maJavaProjectFinalExam; synchronizedclass EmployeeDriver$1 implements java.util.Comparator { void EmployeeDriver$1(); public int compare(Object, Object); } maJavaProjectFinalExam/bin/maJavaProjectFinalExam/Employe eDriver.classpackage maJavaProjectFinalExam; publicsynchronizedclass EmployeeDriver { public void EmployeeDriver();
  • 3. publicstatic void main(String[]); publicstatic void sortEmployee(java.util.ArrayList); publicstatic void printEmployeeDetails(); publicstatic String convertDoubletoCurreny(double); } maJavaProjectFinalExam/src/maJavaProjectFinalExam/Employe e.javamaJavaProjectFinalExam/src/maJavaProjectFinalExam/Em ployee.javapackage maJavaProjectFinalExam; /*{******************************************* * Student Name : Moajep Alagaleen * Course Name: Programming Fundamentals * Course Id:CS219DN * JavaProjectFinalExam ********************************************}*/ /*{ * Purpose of Program: * * prgram used to store the values and returns the values when e ver the other class requested * this program contains all the variables * * }*/ import java.util.ArrayList; publicclassEmployee{ publicString firstName;//store the first name of employee publicString lastName;//Store the last name of employee publicString empStatus;//store the employee status publicdouble hoursWorked;//store the no. of hours worked by e mployee publicdouble hourlyRate;//store the hourly rate of employee publicdouble grossPay;//store the gross pay of employee publicdouble fedTaxes;//store the fed of student publicdouble stateTaxes;//Store the state taxes of employee
  • 4. publicdouble netPay;//stores the net pay of employee publicstaticArrayList<Employee> employeeList=newArrayList< Employee>();//Store the list of all employee's in class publicEmployee()//default constructor { } //Constructor to populate the employee details in employee obje ct and add it to class list publicEmployee(String firstName,String lastName,String empSt atus,double hourlyRate) { Employee employeeDetails=newEmployee();//Create a new emp loyee object and populate values read from user employeeDetails.firstName=firstName;//Initializing the em ployeeDetails firstName variable employeeDetails.lastName=lastName;//Initializing the emp loyeeDetails lastName variable employeeDetails.empStatus="Exempt";//Initializing the em ployeeDetails empStatus variable employeeDetails.hoursWorked=40.00;//Initializing the em ployeeDetails hoursWorked variable employeeDetails.hourlyRate=hourlyRate;//Initializing the employeeDetails hourlyRate variable employeeDetails.grossPay=calcGrossPay(employeeDetails );//Call the getGrossPay method to calculate the gross pay employeeDetails.fedTaxes=calcFedTaxes(employeeDetails );//Call the getFedTaxes method to calculate the federal taxes employeeDetails.stateTaxes=calcStateTaxes(employeeDeta ils);//Call the getStateTaxes method to calculate the state taxes employeeDetails.netPay=calcNetPay(employeeDetails);//C all the getNetPay method to calculate the net pay employeeList.add(employeeDetails);//Add the employee o bject to class details employeeList }
  • 5. //Constructor to populate the employee details in employee obje ct and add it to class list publicEmployee(String firstName,String lastName,String empSt atus,double hoursWorked,double hourlyRate) { Employee employeeDetails=newEmployee();//Create a new emp loyee object and populate values read from user employeeDetails.firstName=firstName;//Initializing the em ployeeDetails firstName variable employeeDetails.lastName=lastName;//Initializing the emp loyeeDetails lastName variable employeeDetails.empStatus="Non- Exempt";//Initializing the employeeDetails empStatus variable employeeDetails.hoursWorked=hoursWorked;//Initializing the employeeDetails hoursWorked variable employeeDetails.hourlyRate=hourlyRate;//Initializing the employeeDetails hourlyRate variable employeeDetails.grossPay=calcGrossPay(employeeDetails );//Call the getGrossPay method to calculate the gross pay employeeDetails.fedTaxes=calcFedTaxes(employeeDetails );//Call the getFedTaxes method to calculate the federal taxes employeeDetails.stateTaxes=calcStateTaxes(employeeDeta ils);//Call the getStateTaxes method to calculate the state taxes employeeDetails.netPay=calcNetPay(employeeDetails);//C all the getNetPay method to calculate the net pay employeeList.add(employeeDetails);//Add the employee o bject to class details employeeList } //this method to calculate the grossPay publicstaticdouble calcGrossPay(Employee employeeDetails) { if(employeeDetails.hoursWorked>40.00)//if employee hours wor ked is more than 40 return(40*employeeDetails.hourlyRate)+((employeeDetails.hour sWorked- 40.00)*employeeDetails.hourlyRate*1.5);//calulating gross pay,
  • 6. 1.5 times to the hours more than 40 else return(employeeDetails.hoursWorked*employeeDetails.hourlyR ate);//grosspay is calculated by hoursworked*hourlyrate } //this methos to calculate the fedTaxes publicstaticdouble calcFedTaxes(Employee employeeDetails) { return(employeeDetails.grossPay*15)/100;//fedTaxes is the 15% of the grossPay } //this method to calculate the stateTaxes publicstaticdouble calcStateTaxes(Employee employeeDetails) { return(employeeDetails.grossPay*6)/100;//stateTaxes is the 6% of the grossPay } //this method to calculate the netPay publicstaticdouble calcNetPay(Employee employeeDetails) { return(employeeDetails.grossPay-employeeDetails.fedTaxes- employeeDetails.stateTaxes);//netPay is the minus of fedTaxes a nd stateTaxes from grossPay } //this method to return the employee first name publicstaticString getFirstName(Employee employeeDetails) { return employeeDetails.firstName; } //this method to return the employee last name publicstaticString getLastName(Employee employeeDetails) { return employeeDetails.lastName; } //this method to return the employee full name publicstaticString getFullName(Employee employeeDetails)
  • 7. { return employeeDetails.firstName+" "+employeeDetails.lastNa me; } //this method to return the employee status publicstaticString getEmpStatus(Employee employeeDetails) { return employeeDetails.empStatus; } //this method to return the employee hours worked publicstaticdouble getHoursWorked(Employee employeeDetails ) { return employeeDetails.hoursWorked; } //this method to return the employee hourly rate publicstaticdouble getHourlyRate(Employee employeeDetails) { return employeeDetails.hourlyRate; } //this method to return the employee gross pay publicstaticdouble getGrossPay(Employee employeeDetails) { return employeeDetails.grossPay; } //this method to return the employee fed taxes publicstaticdouble getFedTaxes(Employee employeeDetails) { return employeeDetails.fedTaxes; } //this method to return the employee state taxes publicstaticdouble getStateTaxes(Employee employeeDetails) { return employeeDetails.stateTaxes; } //this method to return the employee net pay
  • 8. publicstaticdouble getNetPay(Employee employeeDetails) { return employeeDetails.netPay; } //This method is to display the employee by lastName publicstaticvoid getEmployeeByLastName(String lastName) { //checking whether the array has elements are not if(employeeList.size()<=0)//if there are no elements in the array , displaying the output { System.out.println(lastName+" was not found."); } else//array has elements then goes to search { //Use a loop to traverse through all the employee's in the list //index is a loop variable used to print int matchCount=0;//stores the no. of matches for(int index=0;index<employeeList.size();index++) { //Take each object in the array list into a currentEmployee objec t and print the details Employee currentEmployee=employeeList.get(index); if(lastName.equals(currentEmployee.lastName))//comparing the inputed lastName with the employee lastName { System.out.println(currentEmployee.lastName+" was found in " +currentEmployee.firstName+" "+currentEmployee.lastName); matchCount++; } } if(matchCount<=0)//if zero matches, then displaying the output System.out.println(lastName+" was not found."); } }
  • 9. } maJavaProjectFinalExam/src/maJavaProjectFinalExam/Employe eDriver.javamaJavaProjectFinalExam/src/maJavaProjectFinalEx am/EmployeeDriver.javapackage maJavaProjectFinalExam; /*{******************************************* * Student Name : Moajep Alagaleen * Course Name: Programming Fundamentals * Course Id:CS219DN * JavaProjectFinalExam ********************************************}*/ /*{************************************************** * * Purpose of program * * This program is used to read Employee details like first name , last name, employee status, * no. of hours worked and hourly rate to calculate gross pay,net pay * This program also prints the report of all the empoyee's. * This is achieved by displaying a menu to user and allowing hi m to choose an option * }*/ import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Locale; import java.util.Scanner; publicclassEmployeeDriver{
  • 10. //main method publicstaticvoid main(String[] args){ Scanner inputReader=newScanner(System.in);//inputReader obj ect to read data from user int choice=0;//choice stores the menu option entered by user String firstName, lastName,empStatus;//lastName stores the last name of employee, firstName stores the first name of employee , empStatus stores the employee status double hoursWorked,hourlyRate;//hoursWorked to store the no. of hours worked by employee, hourlyRate stores the hourly pay of a employee while(true)//Repeatedly allow the user to make choice until exit is chosen { //Print the menu System.out.println("nEmployee Menu"); System.out.println("---------------"); System.out.println(); System.out.println("1) Input an employee's information"); System.out.println("2) Find an employee by last Name"); System.out.println("3) Display employee payroll information - sorted by last name"); System.out.println("4) Exit"); System.out.println(); System.out.print("Input menu choice: "); try{ //Read the input from user choice=Integer.parseInt(inputReader.nextLine());// choice is a variable to take input from the user if((choice>4)||(choice<1))thrownewNumberFormatException();// If user enters a choice not in the list, throw exception } catch(NumberFormatException invalidInput)//Catch the excepti on if user enters an input not in menu and invalidInput is a insta
  • 11. nce for the exception { System.out.println("Invalid menu selection");//Print error messa ge } switch(choice)//Based on the users choice, do the corresponding tasks { case1://If the input is 1, read the employee details System.out.print("Input the first name of the employee: "); firstName=inputReader.nextLine();//Read the first name of student System.out.print("Input the last name of the employee: "); lastName=inputReader.nextLine();//Read the last n ame of student while(true)//Read the employee status till a valid input is entere d { System.out.print("Input 'E' for Exempt or 'N' for Non- Exempt employee:"); try//check if user enters valid input { empStatus=inputReader.nextLine();//to read the e mployee status if(empStatus.equals("E"))//if user enters E then prompt the user to enter hourly rate { while(true)//Repeatedly allow the user to make choice until exit is chosen { System.out.print("Input the hourly rate:");//prompting to enter h ourly rate try{ hourlyRate=Double.parseDouble(inputReader .nextLine());//converting the given data into double if(hourlyRate<0)// if the user input is not numeric and negative
  • 12. number throws an exception thrownewNumberFormatException();//If the input is not betwee n 0 and 100, throw an exception else break; } catch(NumberFormatException rateError)//ctach block to catch t he exception { System.out.println("Input of hourly rate is invalid");//displaying the error message } } newEmployee(firstName,lastName,empStatus,hourlyRate);//calli ng the constructor to add those details to employeeList break; } elseif(empStatus.equals("N"))//if the user input equals to N { while(true)//Repeatedly allow the user to make choice until exit is chosen { System.out.print("Input the hours worked:");//prompting user to enter data try{ hoursWorked=Double.parseDouble(inputRea der.nextLine());//converting the given data to double if(hoursWorked<0)// if the input is non numeric and negative va lue then throws an exception thrownewNumberFormatException();//If the input is not betwee n 0 and 100, throw an exception else break; } catch(NumberFormatException rateError)//block to catch the ex
  • 13. ception { System.out.print("Input of hours worked is invalid");//displayin g the error message } } while(true)//Repeatedly allow the user to make choice until exit is chosen { System.out.print("Input the hourly rate:");//displying thr mesg t o enter data try{ hourlyRate=Double.parseDouble(inputReader .nextLine());//converting the given data into double if(hourlyRate<0)//if the input is non numeric and negative then t hrows an exception thrownewNumberFormatException();//If the input is not betwee n 0 and 100, throw an exception else break; } catch(NumberFormatException rateError)//ctach block to catch t he exception { System.out.println("Input of hourly rate is invalid");//displaying the error message } } newEmployee(firstName,lastName,empStatus,hoursWorked,hour lyRate);//calling the Employee class consructor to store the data in the employeeList break; } else//if user enters other than E or N then throws an exception thrownewException(); }
  • 14. //catch the exception if the input is not valid catch(Exception statusError)//block to catch the exception { System.out.println("Invalid input - Employee status must be typed as a 'E' or 'N'");//displaying the erroe message } } break; case2: // prmpting the user to enter the lant name System.out.print("Input the last name you wish to search on:"); lastName=inputReader.nextLine(); //calling the method to search the employee list by last name Employee.getEmployeeByLastName(lastName); break; case3://Call the function to display the employee details printEmployeeDetails(); break; case4://Exit from the program inputReader.close(); System.exit(0); } } } //This method to Sort the employee's by lastName and secondar y sort by firstName publicstaticvoid sortEmployee(ArrayList<?> employeeList) { //Use a loop to traverse through all the students in the list //index is a loop variable used to sort for(int index=0;index<employeeList.size();index++) { for(int index1=0;index1<employeeList.size();index1++)//index1 is a loop variable used to sort {
  • 15. Collections.sort(employeeList,newComparator<Object>(){// to s ort the arrayList publicint compare(Object o1,Object o2)//compare method to co mpare the lastNames of students { Employee employee1=(Employee) o1;//declaring employee1 obj ect for Employee class Employee employee2=(Employee) o2;//declaring employee2 obj ect for Employee class int res=employee1.lastName.compareToIgnoreCase(employee2.l astName);//res variable stores the compared result if(res!=0)//if no two students lastNames are same return res; return employee1.firstName.compareToIgnoreCase(employee2.f irstName);//if more than one employee lastName is same then c ompare the firstName } }); } } } //this method prints the employee details publicstaticvoid printEmployeeDetails() { sortEmployee(Employee.employeeList);//Calling met hod to sort the employee's by last name try{ if(Employee.employeeList.size()<=0)//checking the condition w hether the array contains elements thrownewArrayIndexOutOfBoundsException();//throwing the ne w exception } catch(ArrayIndexOutOfBoundsExceptionEmptyError)//EmptyEr ror is a instance for ArrayIndexOfBoundsException class //catch the exception if array contains no elements
  • 16. { System.out.println("No records have been inputted!");//displayi ng the message } if(Employee.employeeList.size()>0)//checking the condition to execute the block of code if it trues { //Print the header/ title of the table System.out.println(); System.out.println("Employee Payroll Report");//Print the repor t title System.out.println("------------------------"); System.out.println(); System.out.print("Employee Name"+"tt"); System.out.print("Status"+"tt"); System.out.print("Hours Workedt"); System.out.print("Hourly Ratet"); System.out.print("Gross Payt"); System.out.print("Federal Taxest"); System.out.print("State Taxest"); System.out.print("Net Pay"); System.out.println(""); for(int index=1;index<=8;index++)//index is a loop variable use d to print dash lines { if(index==5) System.out.print("----------t"); elseif(index==3) System.out.print("------------t"); elseif(index==4) System.out.print("------------t"); elseif(index==1) System.out.print("--------------tt"); elseif(index==2) System.out.print("------tt");
  • 17. elseif(index>=6&&index<=7) System.out.print("-------------t"); else System.out.print("-------t"); } System.out.println(""); DecimalFormat dFormat=newDecimalFormat("#.00");//declaring the dFormat variable to define the format double totalGrossPay=0;//stores the totalGrossPay and initialize s to zero double totalFedTaxes=0;//stores the total federal taxes and initi alizes to zero double totalStateTaxes=0;//stores the total state taxes and initial izes to zero double totalNetPay=0;//stores the total net pay and initializes to zero //Use a loop to traverse through all the employee's in the list for(int index=0;index<Employee.employeeList.size();index++)// index is a loop variable used to print { //Take each object in the array list into a currentEmployee objec t and print the details Employee currentEmployee=Employee.employeeList.get(index); System.out.print(currentEmployee.lastName+", "+currentEmplo yee.firstName+"t");//print first name and last name //If the characters in firstname and last name are less than 14, a dd a tab space if(currentEmployee.firstName.length()+currentEmployee.lastNa me.length()<14) System.out.print("t"); //If the characters in first name and last name are less than 6, ad d another tab space if(currentEmployee.firstName.length()+currentEmployee.lastNa me.length()<6) System.out.print("t"); System.out.print(currentEmployee.empStatus+" ");//prints the e
  • 18. mployee status if(currentEmployee.empStatus.length()<7)//if the statu length is less than 7 then adds a one more tab System.out.print("t"); if(currentEmployee.empStatus.length()<14)//if the statu length i s less than 14 then adds a one more tab System.out.print("t"); System.out.print(dFormat.format(currentEmployee.hoursWorke d)+" t");//prints the hours worked by employee System.out.print(dFormat.format(currentEmployee.hourlyRate)+ " tt");//prints the employee hourly rate System.out.print(convertDoubletoCurreny(currentEmployee.gro ssPay)+"t");//prints the gross pay of employee if(convertDoubletoCurreny(currentEmployee.grossPay).length() <=6)//if gross pay length is less than 6 than add a one more tab System.out.print("t "); System.out.print(convertDoubletoCurreny(currentEmployee.fed Taxes)+"tt");//prints the federal taxes System.out.print(convertDoubletoCurreny(currentEmployee.stat eTaxes)+"tt");//prints the state taxes System.out.print(convertDoubletoCurreny(currentEmployee.net Pay)+"t");//prints the net pay System.out.println(""); totalGrossPay=totalGrossPay+currentEmployee.gross Pay;//calculating the total gross pay totalFedTaxes=totalFedTaxes+currentEmployee.fedT axes;//calculating the total federal taxes totalStateTaxes=totalStateTaxes+currentEmployee.st ateTaxes;//calculating the total state taxes totalNetPay=totalNetPay+currentEmployee.netPay;// calculating the total net pay } System.out.print("ttttttttt---------t----------t------------t-- -----");//printing the dashes System.out.println("");
  • 19. System.out.print("Totals:ttttttttt"+convertDoubletoCurren y(totalGrossPay)+"t"+convertDoubletoCurreny(totalFedTaxes) +"tt"+convertDoubletoCurreny(totalStateTaxes)+"tt"+convert DoubletoCurreny(totalNetPay));//printing the total grosspay and taxes net pay } } publicstaticString convertDoubletoCurreny(doubleCurrencyAmo unt)//method to convert the double to currency { DecimalFormat dFormat=newDecimalFormat("#.00");//declaring the dFormat varible to define the format String currencyString=dFormat.format(CurrencyAmount);//store s the string format of double value String[] currencyStringArray=currencyString.split(".");//splitti ng the string at dot and storing them in the array int currencyInteger=Integer.parseInt(currencyStringArray[0]);/// /storing the first part of the into the interger variable String finalCurrencyString=(NumberFormat.getNumberInstance (Locale.US).format(currencyInteger))+"."+currencyStringArray[ 1];//converting the integer into currency format return finalCurrencyString;//returning the final currency string } }