Need help before i go bald

Procedural programming help

Page 1 of 1

1 Replies - 670 Views - Last Post: 23 June 2008 - 05:44 PM Rate Topic: -----

#1 jsizzle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-April 08

Need help before i go bald

Post icon  Posted 22 June 2008 - 12:57 PM

Hello,

I realize that people on here are not supposed to do homework for other people, but this particular assignment has been driving me up the wall for 2 months now. It's for a self-paced online class so i really have no one to turn to and ask for help. I'm seriously pulling my hair out. Pretty sure i'm making it much more complicated than it needs to be. Here is the basic premise of the problem with my code so far following after it. I will provide comments in the code section on where i need help.

Assignment:

We are given a file of employees and their corresponding employee ID numbers and the sales they make in a given day. We are supposed to print out a file that shows total employee sales per quarter of the day. An example of the final print out would be as follows:

Hour of the day 00 (this being 0:00 - 06:00 or 06:00 - 12:00 etc)
Employee Name Total Sales Commissions
XXXXXXXX 99.99 99.99

start
   perform readData()
	while not eof
	   perform readIntoMemory()
	   count = count + 1
	endwhile
   SIZE = count
   perform totalSalesCalc()
   perform closeUp()
stop

readData()
   DECLARE VARIABLES
   char mainHeading1 = "HOUR OF THE DAY "
   char mainHeading2 = "EMPLOYEE	 TOTAL	  TOTAL"
   char mainHeading3 = "NAME		 SALES	  COMMISSIONS"
   num empIDNum[0] = 103
   num empIDNum[1] = 104
   num empIDNum[2] = 201
   num empIDNum[3] = 319
   num empIDNum[4] = 367
   num empIDNum[5] = 375
   num empIDNum[6] = 400
   char empName[0] = "Edwards"
   char empName[1] = "Rogers"
   char empName[2] = "Krybek"
   char empName[3] = "Delaney"
   char empName[4] = "LaFleur"
   char empName[5] = "Smith"
   char empName[6] = "Black"
   num empTotalSales [6] all = 0
   num commissionRate[0] = .04
   num commissionRate[1] = .05
   num commissionRate[2] = .06
   num commissionRate[3] = .07
   num commissionRange[0] = 0
   num commissionRange[1] = 51000
   num commissionRange[2] = 126000
   num commissionRange[3] = 201000
   num saleTime[0] = 0000
   num saleTime[1] = 0600
   num saleTime[2] = 1300
   num saleTime[3] = 1900
   num saleTime[4] = 2400
   num salesPerson[]
   num month[]
   num day[]
   num year[]
   num time[]
   num salesAmount[]
   num salesPerson
   num month
   num day
   num year
   num time
   num salesAmount
   num SIZE  // keep track of size of arrays read into memory
   num x
   num a
   num b
   num rate
   num commission = 0
   num prevEmp
   open files
   read saleRecord
return

readIntoMemory()
   salesPerson[count] = salesPerson
   month[count] = month
   day[count] = day
   year[count] = year
   time[count] = time
   salesAmount[count] = salesAmount
return

totalSalesCalc()
   count = 0
   while count <= SIZE
	perform hourBreak()
	count = count + 1
   endwhile
return

hourBreak()
   b = 0
   while b < 4
	if time > saleTime[b] & time < saleTime[b + 1]
	   print mainHeading1, saleTime[b], "THRU", saleTime[b + 1]
	   print mainHeading2
		   print mainHeading3
	   
	else
	endif
   endwhile
   perform empBreak()
return

empBreak()
//this is where i'm getting seriously mixed up.  I keep thinking of using while loop with a series of nested if statements to match the employees with the sales but keep on confusing myself to no end
return

getSales()
   x =0
   while salesPerson not equal empIDNum[x]
	x = x + 1
   endwhile
   empTotalSales[x] = empTotalSales[x] + salesAmount
return

determineCommission()
   a = 3
   while a >= 3
	if empTotal[x] >= commissionRange[a]
	   rate = commissionRate[a]
	   a = -1
	else
	   a = a - 1
	endif
   endwhile
   commission = empTotal[x] * rate
   print empName[x], empTotal[x], commission
return

closeUp()
   closefiles
return




Any help on this would be greatly appreciated as i'm stuck in a rut and pulling out my hair. Thank you very much in advance.

Jsizzle

Is This A Good Question/Topic? 0
  • +

Replies To: Need help before i go bald

#2 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1376
  • View blog
  • Posts: 10,951
  • Joined: 06-February 08

Re: Need help before i go bald

Posted 23 June 2008 - 05:44 PM

What language is this?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1