Very Simple Payroll System in Java (Dos Base) - Java Tutorials - Codecall
Very Simple Payroll System in Java (Dos Base) - Java Tutorials - Codecall
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
VerySimplePayrollSystemInJava(DosBase)
Startedbypapabear,May26201205:34AM
simplepayrollsystem,
payrollinjava,
howtomakepayrollsystem,
makingpayrollinjava,
payrollsystem,
DOSBASEPAYROLL,
Page1of3
Posted26May201205:34AM
papabear
Helloeveryoneandthanksforvisitingmytutorialasyoucansee
thiswouldbeaverysimplePayrollSysteminjavaandwould
runinCommandPrompt.Thiswouldn'thaveanyhard
validationsorsomethingbecauseit'sverysimplemyintention
forthisistoteachthebasicfunctionofapayrollsystemaswell
astoimproveandhonemylogicandthelogicofmyreaders.To
enhancemineandtheirproblemsolvingability,asI'mwriting
thistutorialI'malsolearningthis
solet'slearntogether..
Difficulty:Intermediate
ProgrammingStyle:Procedural
OverviewoftheProject
Theaccountingdivisionismanagingthesalarycomputationof
AdvertiseHere
theagencyemployees.Theyarecomputingweeklynetincome
ofthreehundred(300)employeeswithvarioussalaryrates.To
facilitatethecomputationacomputerprogramneedstobe
designed.
RecentTopics
TechnicalSpecification
(OFFTOPIC)Mangaisoneofthebestthing...
sandrayanAug02201601:26AM
ProjectFileTransfer
c0d3bac0nAug01201601:26AM
A.Environment
Theapplicationisdesignedforconsole(DOSMode).
B.User
DelphiPascalProgramming
KabagheKAndyJul29201608:28AM
Introductionofbharathmachine
bharathindiaJul27201601:33AM
howtosaveapasswordinencryptedforminPHP?
AbhishekMaheshwariJul21201611:46PM
Theapplicationisdesignedforasingleuser.
C.Policies
Salaryrate
RecentBlogEntries
RemoveCharactersinStringTSQLwith
NoLoopPart2
Theemployeehavethefollowingsalaryrates
Barnsite'sBlog09May
Level1=Php380.00/day
RemoveCharactersinStringTSQLwith
NoLoop
Level2=Php450.00/day
Level3=Php550.00/day
HourlyRate
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
Barnsite'sBlog09May
Blackhathacking
DarkLordofthePenguins'sBlog05Nov
1/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
Hourlyrateforregularworkingdayiscomputedusing
theformulabelow:
HourlyRate=Employeerateperlevel/8
HolidayRate
Essentialskillsforcomputernerds
DarkLordofthePenguins'sBlog11Sep
AdventuresinVirtualBox
DarkLordofthePenguins'sBlog22Jul
Hourlyrateforholidayiscomputedusingtheformula
below:
RecentStatusUpdates
HourlyRate(holidays)=(Employeerateperlevel/8)*1.1
TopHatProductions115
Overtimerate
TheTXPNetworkiscomingbackthisJuly...
Overtimerateiscomputedusingtheformulabelow:
moonvik
Overtimerate/hour=(Basicsalaryrate/8hrs)*1.1
Java...
Overtimestartsat17:30andendsat20:30
Workload
Eachworkerisrequiredtoworkfivedaysaweek,eight
hoursperday(08:0017:00)
25Jun
12Feb
camD357
04Feb
Ilovethiscommunity!
JackJames
02Jan
Allowance
hiiamjackiamseoexpertjackjameswouldlove
youtoreadnewpost
EachemployeeisentitledwithFivehundredpesos(Php
mrmojorisin
500.00)weeklyallowance.
password
Deductions
01Oct
ViewAllUpdates
Eachemployeeissubjectedtothefollowingdeductions:
Tardinessincludesabsences,undertimeandlate.Refer
tosalarycomputationformoredetails.
Taxdeductionis10%oftheweeklygrosssalaryincome
GSIS(1%forlevel1,1.5%forlevel2and2%forlevel3
ofthebasicsalaryrateoftheworker)
SalaryComputation
Late(inhours)=timein08:00//incasetimeinisless
thanorequalto08:00,Lateisequaltozero
Undertime(inhours)=17:00timeout//incasetimeout
PopularTags
networking ManagedC++ stream console
database authentication VisualBasic4/5/6
session Connection import syntax hardware
html5 asp.net array java mysql php c++
string C# HTML loop timer jquery ajax
programming Android javascript css assembly
form c vb.net xml linkedlist login encryption
pseudocode calculator setup sql help python
game combobox binary helloworld grid
innerHTML
isequalorgreaterthan17:00,undertimeisequaltozero
Dailyworkhours=8hrs(late+undertime)//8hrs
shouldbereplacedwith0incasethepersonisabsent.
Overtime=overtimeoutovertimein//overtimestarts
at17:30andendsat20:30
Overtimeincome=summationof(overtimex
overtimerateperhour)
Regularincome=summationof(hourlyratexdaily
workhours)
WeeklyGrossSalaryIncome(WGSI)=regular
income+overtime
WeeklyNetSalaryIncome=(WGSI(Taxdeduction
+GSIS))+allowance
Totalnumberofworkhours=summationofdaily
workhours
A.SystemOperation
1.Inputs
Thesystemwillrequirethefollowinginputsfromthe
user:
a.Employeecode
b.Time(InOut),MondayFriday
c.Overtime(InOut)MondayFriday
d.Coveragedate
2.Process
Aftertheaboveinformationhasbeenenteredthesystem
willutilizeitsrecordtolookfortheleveloftheemployee
(employee.txt)thencomputefortheregularincome,
overtimeincome,grossincome,netincome.
A.DataFormat
Timewillbeinmilitaryformat(00:0024:00)
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
2/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
DateshallbeinthisformatMay18,2009
Currencyshallbeinthisformat(Php2,800.00)
here'smysampleoutputs
(http://forum.codecall.net/uploads/monthly_05_2012/post
347030407390001338035967.jpg)
(http://forum.codecall.net/uploads/monthly_05_2012/post
347030858825001338036103.jpg)
Nowthatyou'vereadtheproblemandthepolicieswecannow
createasolutionandstartprogramming.
Beforestartingwemustfirstcreateanewfileandnameit
"Employee.txt"
ifyoueverreadthepolicies..thatfilewillcontaintheemployee
code,employeelevel,andsalaryrate/hour.
PutthisinsidetheEmployee.txt
001
EmployeeA
Level1
380
002
EmployeeB
Level2
450
003
EmployeeC
Level3
550
pleasemakesurethateveryemployeerecordwasseparatedbya
newline.Wearegoingtousethisasasignthattherecordis
finish.
Let'screateourmainclass
importjava.io.*
publicclasspayroll{
publicstaticvoidmain(Stringargs[])throwsIOException{
}
}
andimportthejavainputoutputlibrarytobeabletouse
bufferedreader.
Let'sdeclareavariablethatwillbeuseasaflagiftheentered
employeecodedoesexists..ifnotwewilllettheusertoenter
anotherone.
booleannotExists=true
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
3/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
let'screateawhileloopforthis.
while(notExists==true){
//userinputanddeclaration/startoftherealprogram
//willgohere.
//iftheuserinputsinvalidemployeecodethen
//don'tchangethevalueofnotExiststotruesoitwillrepeatatthestart.
//ifitdoesexiststhenlet'schangethevalueofnotExiststofalsetotellthatwefoundamatchingrecord
//forthatemployeecode
}
let'sdeclarethevariablesandobjectsthatwearegoingtousein
thisproject.
//objects
FileInputStreamfstream=newFileInputStream("Employee.txt"
DataInputStreamin=newDataInputStream(fstream)
BufferedReadertextReader=newBufferedReader(newInputStreamReader
BufferedReaderbr=newBufferedReader(newInputStreamReader
//Declarations
Stringstr="",UserInput="",tmp=""
Stringempcode="",empname="",emplevel=""
doubleemprate=0
intctr=0
StringtimeIn="",timeOut="",holiday="",overtin="",overtout=
doubletotalHours=0,hours=0,minutes=0,tmpTime=0,late=0
doublesalary=0,overSal=0,tmpSal=0,regular=0
doubletmpLate=0,tmpHour=0,tmpUndertime=0
underthedeclarationslet'snowasktheuserforinput
System.out.print("EnterEmployeeCode:")
UserInput=br.readLine()
let'snowfindiftheuserinputtedemployeecodeisthereby
loopingthroughthetextfile
//loopthroughthetextfile
while((str=textReader.readLine())!=null){
if(str.equalsIgnoreCase(UserInput)){
empcode=UserInput
//foundtheuserinput,storethedetailsnow
while((tmp=textReader.readLine())!=null){
//letsputeverylineintoavariableforreferenceuse
switch(ctr){
case0:
empname=tmp
break
case1:
emplevel=tmp
break
case2:
emprate=Double.parseDouble(tmp)
break
}
ctr++
}
}
//System.out.println(str)
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
4/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
}
we'redonestoringtheemployeedataintosomevariablesand
let'snowcheckiftheemployeeexistsbyusingacontrol
statementifelse
//checkifrecordexists
if(!(empcode.equalsIgnoreCase(""))){
//continuetheprocess
}else{
//returntofirstloop
System.out.println("RecordDoesn'tExists"
notExists=true
}
let'scontinue..
Displaytheemployeedataifitsexisting
//displaytherecordifitexists
System.out.println("EmployeeDetails"
System.out.println("NameoftheEmployee:"+empname)
System.out.println("EmployeeCode:"+empcode)
System.out.println("EmployeeLevel:"+emplevel)
System.out.println("EmployeeRate:"+emprate)
remembertoputthecodeaboveinsidetheifstatementwhere
wecheckiftheemployeecodeexists.
let'scontinuewiththeuserinput,andlettheuserinputthe
timeinandtimeoutfrommondaytofridayandtheovertime.
//enterfortimeinandtimeout
StringCurrentDay=""
intctr2=1
while(ctr2<=5){
switch(ctr2){
case1:
CurrentDay="Monday"
break
case2:
CurrentDay="Tuesday"
break
case3:
CurrentDay="Wednesday"
break
case4:
CurrentDay="Thursday"
break
case5:
CurrentDay="Friday"
break
}
System.out.println()
System.out.println()
//askfortimeinandtimeoutforregularandovertime
//alsoaskiftodayisholiday
System.out.print("EnterTimeInfor"+CurrentDay+":")
timeIn=br.readLine()
System.out.print("EnterTimeOutfor"+CurrentDay+":")
timeOut=br.readLine()
System.out.print("Istodayholiday?[y/n]:")
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
5/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
holiday=br.readLine()
System.out.print("EnterTimeInforOverTime:")
overtin=br.readLine()
System.out.print("EnterTimeOutforOverTime:")
overtout=br.readLine()
theuserwillhavetoinputcorrectlytheformatofthetimeis
hh:mm
ex.08:00
wehavetoseparatethehourfromtheminutetodothatwecan
makeuseofthefunctionsplit.
//splitthehourandminute
Stringtin[]=timeIn.split(":")
Stringtout[]=timeOut.split(":")
here'showIcalculatedthetime
//timecalculation
hours+=(Double.parseDouble(tout[0])Double.parseDouble(tin[
tmpTime=Double.parseDouble(tout[0])Double.parseDouble(tin
tmpHour=(Double.parseDouble(tout[0])Double.parseDouble(tin
calculationforlateandundertime
//minutelateandundertimecalculation
if(tmpTime<=9){
late+=Double.parseDouble(tin[1])
tmpLate=Double.parseDouble(tin[1])
}
if(Double.parseDouble(tout[0])<17){
undertime+=60Double.parseDouble(tout[1])
tmpUndertime=60Double.parseDouble(tout[1])
}
here'sthesalaryrateperhourcalculationandperday
calculation
//salaryratecalculation
if(holiday.equalsIgnoreCase("y")){
tmpSal=(emprate/8)*1.1
tmpTime=(((tmpHour*60)(tmpLate+tmpUndertime))/60)
hours=tmpTime
overHours+=(((tmpHour*60)(tmpLate+tmpUndertime))/60)
overSal+=tmpSal*tmpTime
}else{
tmpSal=emprate/8
tmpTime=(((tmpHour*60)(tmpLate+tmpUndertime))/60)
salary+=tmpSal*tmpTime
//System.out.println(salary+"="+tmpSal*tmpHour+""+tmpLate+""+tmpUndertime+"")
}
ifeverthereisanovertime..here'showIsolveit
//ifthereisovertime
if(!(overtin.equalsIgnoreCase("00:00")||overtin.equalsIgnoreCase
Stringovin[]=overtin.split(":")
Stringovout[]=overtout.split(":")
doubletmp1=0
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
6/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
doubletmp2=0
doubleminTmp=0
tmp1=Double.parseDouble(ovin[0])<=17?17:Double.parseDouble
tmp2=Double.parseDouble(ovout[0])<=20?20:20
minTmp=Double.parseDouble(ovin[1])+Double.parseDouble(ovout
if((tmp2tmp1)<=3&&tmp2tmp1>0){
overMinutes=((tmp2tmp1)*60)minTmp
overHours+=overMinutes/60
doubleoverTmp=overMinutes/60
doubleoverRate=(emprate/8)*1.1
overSal+=overRate*overTmp
}
}
beforetheendofthelastwhileloopwehavetoincrementthe
counter
ctr2++
inordertomoveintothenextday.
ourbasiccalculationsisnowdone..wenowhavetocalculateall
thetotaltaxandgsisandNetincome
let'sasktheuserforthedatespan
System.out.print("EnterDateCovered:")
Stringcovered=br.readLine()
let'scalculatethetotalhoursofworktheemployeedid..by
convertingthehoursintominutesandaddingtheminutes
togetherandconvertingitbackintohours
minutes+=(hours*60)(late+undertime)
totalHours=minutes/60
let'snowprintsomedetails
System.out.println()
System.out.println("")
System.out.println("NameoftheEmployee:"+empname)
System.out.println("EmployeeCode:"+empcode)
System.out.println("EmployeeLevel:"+emplevel)
System.out.println("EmployeeRate:"+emprate)
System.out.println("")
System.out.println("DateCovered:"+covered)
System.out.println("TotalHours:"+totalHours)
System.out.println("Overtime:"+overHours)
System.out.println("RegularIncome:"+salary)
System.out.println("OvertimeIncome:"+overSal)
System.out.println("GrossIncome:"+(salary+overSal))
System.out.println("Deductions")
here'sthetaxandgsiscomputationwiththenetincome
calculation
//taxandgsisdeductioncomputation
doubletax=((salary+overSal)*.10)
doublegsis=0
if(emplevel.equalsIgnoreCase("Level1")){
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
7/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
gsis=(salary+overSal)*.01
}elseif(emplevel.equalsIgnoreCase("Level2")){
gsis=(salary+overSal)*.015
}else{
gsis=(salary+overSal)*0.02
}
System.out.println("*Tax:"+tax)
System.out.println("*GSIS:"+gsis)
System.out.println("NetIncome:"+(((salary+overSal)(tax+gsis
System.out.println("")
notExists=false
wehavetomakenotExistvalueintofalsebecausewewantto
tellthattheuserexistsandwewanttoterminatetheloop.
puttingallthecodesnippetstogether
importjava.io.*
publicclasspayroll{
publicstaticvoidmain(Stringargs[])throwsIOException{
booleannotExists=true
while(notExists==true){
//objects
FileInputStreamfstream=newFileInputStream("Employee.txt"
DataInputStreamin=newDataInputStream(fstream)
BufferedReadertextReader=newBufferedReader(newInputStreamReader
BufferedReaderbr=newBufferedReader(newInputStreamReader
//Declarations
Stringstr="",UserInput="",tmp=""
Stringempcode="",empname="",emplevel=""
doubleemprate=0
intctr=0
StringtimeIn="",timeOut="",holiday="",overtin="",overtout=
doubletotalHours=0,hours=0,minutes=0,tmpTime=0,late=0
doublesalary=0,overSal=0,tmpSal=0,regular=0
doubletmpLate=0,tmpHour=0,tmpUndertime=0
System.out.print("EnterEmployeeCode:")
UserInput=br.readLine()
//loopthroughthetextfile
while((str=textReader.readLine())!=null){
if(str.equalsIgnoreCase(UserInput)){
empcode=UserInput
//foundtheuserinput,storethedetailsnow
while((tmp=textReader.readLine())!=null){
//letsputeverylineintoavariableforreferenceuse
switch(ctr){
case0:
empname=tmp
break
case1:
emplevel=tmp
break
case2:
emprate=Double.parseDouble(tmp)
break
}
ctr++
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
8/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
}
}
//System.out.println(str)
}
System.out.println()
System.out.println()
//checkifrecordexists
if(!(empcode.equalsIgnoreCase(""))){
//displaytherecordifitexists
System.out.println("EmployeeDetails"
System.out.println("NameoftheEmployee:"+empname)
System.out.println("EmployeeCode:"+empcode)
System.out.println("EmployeeLevel:"+emplevel)
System.out.println("EmployeeRate:"+emprate)
//enterfortimeinandtimeout
StringCurrentDay=""
intctr2=1
while(ctr2<=5){
switch(ctr2){
case1:
CurrentDay="Monday"
break
case2:
CurrentDay="Tuesday"
break
case3:
CurrentDay="Wednesday"
break
case4:
CurrentDay="Thursday"
break
case5:
CurrentDay="Friday"
break
}
System.out.println()
System.out.println()
//askfortimeinandtimeoutforregularandovertime
//alsoaskiftodayisholiday
System.out.print("EnterTimeInfor"+CurrentDay+":")
timeIn=br.readLine()
System.out.print("EnterTimeOutfor"+CurrentDay+":")
timeOut=br.readLine()
System.out.print("Istodayholiday?[y/n]:")
holiday=br.readLine()
System.out.print("EnterTimeInforOverTime:")
overtin=br.readLine()
System.out.print("EnterTimeOutforOverTime:")
overtout=br.readLine()
//splitthehourandminute
Stringtin[]=timeIn.split(":")
Stringtout[]=timeOut.split(":")
//timecalculation
hours+=(Double.parseDouble(tout[0])Double.parseDouble(tin[
tmpTime=Double.parseDouble(tout[0])Double.parseDouble(tin
tmpHour=(Double.parseDouble(tout[0])Double.parseDouble(tin
//minutelateandundertimecalculation
if(tmpTime<=9){
late+=Double.parseDouble(tin[1])
tmpLate=Double.parseDouble(tin[1])
}
if(Double.parseDouble(tout[0])<17){
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
9/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
undertime+=60Double.parseDouble(tout[1])
tmpUndertime=60Double.parseDouble(tout[1])
}
//salaryratecalculation
if(holiday.equalsIgnoreCase("y")){
tmpSal=(emprate/8)*1.1
tmpTime=(((tmpHour*60)(tmpLate+tmpUndertime))/60)
hours=tmpTime
overHours+=(((tmpHour*60)(tmpLate+tmpUndertime))/60)
overSal+=tmpSal*tmpTime
}else{
tmpSal=emprate/8
tmpTime=(((tmpHour*60)(tmpLate+tmpUndertime))/60)
salary+=tmpSal*tmpTime
//System.out.println(salary+"="+tmpSal*tmpHour+""+tmpLate+""+tmpUndertime+"")
}
//ifthereisovertime
if(!(overtin.equalsIgnoreCase("00:00")||overtin.equalsIgnoreCase
Stringovin[]=overtin.split(":")
Stringovout[]=overtout.split(":")
doubletmp1=0
doubletmp2=0
doubleminTmp=0
tmp1=Double.parseDouble(ovin[0])<=17?17:Double.parseDouble
tmp2=Double.parseDouble(ovout[0])<=20?20:20
minTmp=Double.parseDouble(ovin[1])+Double.parseDouble(ovout
if((tmp2tmp1)<=3&&tmp2tmp1>0){
overMinutes=((tmp2tmp1)*60)minTmp
overHours+=overMinutes/60
doubleoverTmp=overMinutes/60
doubleoverRate=(emprate/8)*1.1
overSal+=overRate*overTmp
}
}
ctr2++
}
System.out.print("EnterDateCovered:")
Stringcovered=br.readLine()
minutes+=(hours*60)(late+undertime)
totalHours=minutes/60
System.out.println()
System.out.println()
System.out.println("")
System.out.println("NameoftheEmployee:"+empname)
System.out.println("EmployeeCode:"+empcode)
System.out.println("EmployeeLevel:"+emplevel)
System.out.println("EmployeeRate:"+emprate)
System.out.println("")
System.out.println("DateCovered:"+covered)
System.out.println("TotalHours:"+totalHours)
System.out.println("Overtime:"+overHours)
System.out.println("RegularIncome:"+salary)
System.out.println("OvertimeIncome:"+overSal)
System.out.println("GrossIncome:"+(salary+overSal))
System.out.println("Deductions")
//taxandgsisdeductioncomputation
doubletax=((salary+overSal)*.10)
doublegsis=0
if(emplevel.equalsIgnoreCase("Level1")){
gsis=(salary+overSal)*.01
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
10/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
}elseif(emplevel.equalsIgnoreCase("Level2")){
gsis=(salary+overSal)*.015
}else{
gsis=(salary+overSal)*0.02
}
System.out.println("*Tax:"+tax)
System.out.println("*GSIS:"+gsis)
System.out.println("NetIncome:"+(((salary+overSal)(tax+gsis
System.out.println("")
notExists=false
}else{
System.out.println("RecordDoesn'tExists"
notExists=true
}
}
}
}
Note:Ididn'tputsomuchexplanationintothecodesbecauseI
expectedthatyouhaveanIntermediateknowledgeinjava
programming.Mymaingoalistogiveyoutheproblemandyou
trytocreateyourown.IjustshowedonhowIdidit
PS:IfyoucanseeIdidn'tputsomuchvalidationsandIdidn't
followthecurrencyformatinmydisplayreport.I'mchallenging
youtoexperimentanddoit
PSS:Thisisabasiconesopleasenoflamming...
PSSS:IhavesomanyvariablesthatIdidn'tactuallyuse..tryto
cleanthecode
here'sthecompleteprojectfilefeelfreetodownloaditfor
referenceuse.
(http://forum.codecall.net/index.php?
app=core&module=attach§ion=attach&attach_id=9780)
leo.zip(http://forum.codecall.net/index.php?
app=core&module=attach§ion=attach&attach_id=9780)
4.58KB2238downloads
GoodLuckandHappyCodingGuys!
EditedbyRoger,03February201309:54AM.
wimDC
Posted29May201204:39AM
Youshouldatleastfollowthenamingconventions
(http://www.oracle.com/technetwork/java/codeconv
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
11/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
138413.html),bywhichI'mnotlookingatindentation,spaces,
orenters.Butclasseswithoutacapitalletterandvariables
startingwithoneisa'nono'.
Andmanageyourresources
Quote
AlwaysCloseStreams
Closingastreamwhenit'snolongerneededisveryimportantso
importantthatCopyBytesusesafinallyblocktoguaranteethatboth
streamswillbeclosedevenifanerroroccurs.Thispracticehelps
avoidseriousresourceleaks.
OnepossibleerroristhatCopyByteswasunabletoopenoneorboth
files.Whenthathappens,thestreamvariablecorrespondingtothe
fileneverchangesfromitsinitialnullvalue.That'swhyCopyBytes
makessurethateachstreamvariablecontainsanobjectreference
beforeinvokingclose.
src:http://docs.oracle.c...ytestreams.html
(http://docs.oracle.com/javase/tutorial/essential/io/bytestrea
ms.html)
Posted29May201203:08PM
papabear
'wimDC',on29May20128:39PM,said:
Youshouldatleastfollowthenamingconventions
(http://www.oracle.com/technetwork/java/codeconv138413.html),
bywhichI'mnotlookingatindentation,spaces,orenters.Butclasses
withoutacapitalletterandvariablesstartingwithoneisa'nono'.
Andmanageyourresources
src:http://docs.oracle.c...ytestreams.html
(http://docs.oracle.com/javase/tutorial/essential/io/bytestreams.ht
ml)
FirstofallIwouldliketothankyouforatleastreadingmypost
andevencommentingintoit
thiscodeisindentedpleasedownloadthesourcecodetosee
formyvariablesIusesvariablesthatdescriptivesoIcaneasily
rememberwhatisit..it'sjustthatwhenIpastedthecodeinthe
forumitgivesnoindention
aboutmyclassname
Idon'twanttohaveatypoandPayrollisonlyaonewordsowhy
wouldIhavetocareaboutmakingPcapitalizewhereImight
typoitinpwhencompiling?BecauseIusesnotepadandcmdin
creatingthisandjavaisastrictlycasesensitive.Ionlyapplythe
capitalizewhenIhave2wordsinmyclassnamelike
PayrollSystem.IfyoucannoticeintosomeofmyvariablesI
haveoverHours,overMinutes,tmpSal,overSaletc...whichI
capitalizeoneword
Icloseseverythinginmyfullsourcecode,whichIdidn'tput
everythinginhere,becausethisproblemissomething
controversialbecauseit'saprogrammingexamthatsome
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
12/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
peopleareresearchingfor.Ifyouwillnoticeattheendofthe
tutorialI'mchallengingthemtodotherestofthethingsthat
theythinkshouldbethere
mypurposeistojustgiveasamplecodeandgivethemthe
problemsotheycantrytocreatetheirown..
Posted30May201202:49PM
Sinipull
Quote
aboutmyclassname
Idon'twanttohaveatypoandPayrollisonlyaonewordsowhy
wouldIhavetocareaboutmakingPcapitalizewhereImighttypoit
inpwhencompiling?BecauseIusesnotepadandcmdincreating
thisandjavaisastrictlycasesensitive.Ionlyapplythecapitalize
whenIhave2wordsinmyclassnamelikePayrollSystem.Ifyoucan
noticeintosomeofmyvariablesIhaveoverHours,overMinutes,
tmpSal,overSaletc...whichIcapitalizeoneword
Badidea.ClassnamesarealwaysUpperCase.Thathelps
programmerstoidentifyifit'saclassnameorvariable/field
name.rightnowthere'snowaytotell,if"payroll"isa
field/variableoraclass.It'snotreallyamatterofdiscussionor
opinion,it'sjustsomethingthatisacceptedinJavacommunity.
Posted30May201202:58PM
papabear
'Sinipull',on31May201206:49AM,said:
Badidea.ClassnamesarealwaysUpperCase.Thathelps
programmerstoidentifyifit'saclassnameorvariable/fieldname.
rightnowthere'snowaytotell,if"payroll"isafield/variableora
class.It'snotreallyamatterofdiscussionoropinion,it'sjust
somethingthatisacceptedinJavacommunity.
yesthereisawayoftellingthatitisindeedandclearlyaclass.
publicclasspayroll
itisaproceduralprogrammingstyle,pleasereadeverything
beforecommenting,thankyousomuchandgoodluck
Ihavedifferentstyleinprogrammingandsotheotherdoes
pleaselookcloselythatit'stheonlyclasstherehaha
Posted30May201203:07PM
Sinipull
Youdon'tunderstand.There'snoproceduralprogramming
styleinJava.Javaisfullyobjectoriented.
Ifyouaredistributingyourcodetoothersunderthetitleof
"Tutorial",thenit'syourresponsibilitytomakeitatleastfollow
theJavaconvention.
ClassesshouldbewrittenUpperCamelCase
Methods/Variables/Fieldsshouldbewritten
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
13/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
lowerCamelCase
Posted30May201203:15PM
papabear
'Sinipull',on31May201207:07AM,said:
Youdon'tunderstand.There'snoproceduralprogrammingstylein
Java.Javaisfullyobjectoriented.
Ifyouaredistributingyourcodetoothersunderthetitleof"Tutorial",
thenit'syourresponsibilitytomakeitatleastfollowtheJava
convention.
ClassesshouldbewrittenUpperCamelCase
Methods/Variables/FieldsshouldbewrittenlowerCamelCase
YesIunderstand>.<andthereisaproceduralstyleinjava,and
thatistheverybasic.whatIdidinthistutorialistogivereaders
someproblemandgivethemsomeinsightsonhowIdidit
withoutgivingthemafullcode.I'mcomfortableinthatway
I'monlyusingnotepadandcmdwhenIwrotethissoIdon't
haveagoodsyntaxsuggesterandvariablefinder.SoIapplied
lowercaseintheclasssoIcan'thaveatypowhencompilingitin
"javacpayroll.java"Don'tworryI'musingacapitalizeclasses
whenI'musingnetbeansandjcreatorsoyouhavenothingto
worryabout"people'srule"inprogramming
Posted01June201203:05PM
lethalwire
'papabear',on31May201207:15AM,said:
YesIunderstand>.<andthereisaproceduralstyleinjava,andthat
istheverybasic.whatIdidinthistutorialistogivereaderssome
problemandgivethemsomeinsightsonhowIdiditwithoutgiving
themafullcode.I'mcomfortableinthatway
I'monlyusingnotepadandcmdwhenIwrotethissoIdon'thavea
goodsyntaxsuggesterandvariablefinder.SoIappliedlowercasein
theclasssoIcan'thaveatypowhencompilingitin"javac
payroll.java"Don'tworryI'musingacapitalizeclasseswhenI'm
usingnetbeansandjcreatorsoyouhavenothingtoworryabout
"people'srule"inprogramming
Ifyou'rewritingatutorialforpossiblythousandsofpeopleto
read,wouldn'tyouwantallofyourcodetofollowthemostbasic
standardsthough?
Evenifitisabasictutorial,itcouldpotentiallythrowalotof
newcomersofftrack.ThenwhentheypostatopicunderCC's
"JavaHelp"sectionthefirstthingDCandSinipullaregonnado
isbashonthenewcomerfornotcapitalizingtheirclassnames
andnotusingcamelcase.=)
NohardfeelingsDCandSinipull.
Now,youdon'twanttheseguysbashingonthenewcomersdo
you?
Justsomethingtokeepinmind.
papabear
Posted01June201204:16PM
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
14/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
'lethalwire',on02Jun201207:05AM,said:
Ifyou'rewritingatutorialforpossiblythousandsofpeopletoread,
wouldn'tyouwantallofyourcodetofollowthemostbasicstandards
though?
Evenifitisabasictutorial,itcouldpotentiallythrowalotof
newcomersofftrack.ThenwhentheypostatopicunderCC's"Java
Help"sectionthefirstthingDCandSinipullaregonnadoisbashon
thenewcomerfornotcapitalizingtheirclassnamesandnotusing
camelcase.=)
NohardfeelingsDCandSinipull.
Now,youdon'twanttheseguysbashingonthenewcomersdoyou?
Justsomethingtokeepinmind.
yesI'llkeepthoseonmindandwillapplycaseruleonthenext
tutorials
I'minarushwhendoingthissoIleftitsmallcase
thankyou
Posted01October201205:19AM
Ziegfred
cananyonepostapayrollwhereyoucanputanEmployee?and
doeshaveamenu?withsearch?listofemployees?
Posted01October201206:14AM
papabear
'Ziegfred',on01Oct20129:19PM,said:
cananyonepostapayrollwhereyoucanputanEmployee?anddoes
haveamenu?withsearch?listofemployees?
youareaskingforacompletesystem?I'msorrybutwecan't
giveyouone..butwecanhelpyouifyouwant..butpleasestart
theprojectfirstandshowuswhereyougotstuck
:)
Posted01October201206:17AM
Ziegfred
imonlyhelpingmygirlfriendforherproject.
atthis
:) imnotgood
:(
beenlookingformanysitesforthisPayrollthing
BacktoJavaTutorialsNextUnreadTopic
Page1of3
LanguageForums
Java
HowtomakeJava
payrollsystemwith
GUI
Startedbynilshav,08
Dec2012 java,java
1reply
3050views
dargueta
08Dec2012
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
15/16
8/4/2016
VerySimplePayrollSystemInJava(DosBase)JavaTutorialsCodecall
gui,payrollsystemand1
more...
http://forum.codecall.net/topic/70033verysimplepayrollsysteminjavadosbase/
16/16