You are on page 1of 106

Problem Definition

Golden Enterprise was privately owned by Mark Gentles, on migration the United States the
company was bought by Jordan Spark and renamed Spark Enterprise. The Staff that was working
before did not change due to fact they were already trained and knew the day to day process of
the business.
Checking the financial statements of Golden Enterprise and the functions of the business, the
following was noticed by Mr. Spark: The company has not being maximizing on its targeted
profits for each year, there wasnt an effective system in place to serve customers, the billing was
done manually which of its self was time consuming,. The information/data that is required from
employees are stored in a book, hours work by employees are also written in a log book and
from this book data/information is used to manually calculate employees salary.
The company consists of fifteen (15) workers, the business sells a variety of items: Baking
Supplies, Beverages, Meats, and Hair Products.
On any given working day a customer would join the line if there is no customer at the cashier,
the customer would then go to the cashiers counter and order what is needed, the cashier would
then write up sales invoice and hand it to the bagger who gets the items needed after which a
double check is made by the manager then the customer collects items purchase by the waiting
area.
The supervisor is to give a monthly report which consists of data on working staff, their: First
Name, Last Name, Account Number, Hours work for the month, the days present and days
absent, days early, days late, Contact Numbers and their address. With all this data collected and
process manually the company is running out of space to store documents, its been a problem
for years in sorting out papers.
Mr. Spark wishes to go digital, with having a computerized system that will perform the
functions of the business, with such advancement Revolution coders was offered employment
with creating a program that will allow users to input the following data, hours work for the
month, the days present and days absent, days early days late of each employee. With all this
data the program will give a monthly report of each employees: salary, hours work, days

present, and days absent. The program should all so print a receipt with the items purchased:
including item names, their expired date, price, time of purchase, receipt number and the
customer name, from the receipt number the customer will be issued items purchase in that order.
The program will chooses employee/employees of the month on the basis on the basis of the
worker who has the most hours at the end of the month.. All data entered by the user will be able
to be re-viewed and delete.
This program has advantages which include:
Since paper usage has reduced, this has a positive effect on the environment.
Data/information can be assessed in real time.
Tasks are less time consuming.

Narrative
The main purpose of this program is to store data on employees, calculates and print a receipt
with the items purchase by the customer, finds an employee/employees of the month ,show to the
total sales made for each day/month.
The user is prompt with a welcome screen followed by a main menu where there is 7 options to
choose from. If the wrong option is chosen then the user will be prompt that that is incorrect.
Option 1 allows the user to store data on employees, delete data on employees, view a single
employee record or view all records of employee s. .
Option 2 allows the user to enter the cashier system. Where you user is prompt to enter an id
number of the good, the amount is entered and the program calculates the total. The user can now
enter another good id number or total bill with takes the customer name and the amount paid
followed by the printing of a receipt after any key is press it returns to the menu.
Option3 shows the employee of the month.
Option4 shows total sales made.
Option 5 enters payroll system
Option 6 enters check out area
Option 0 saves necessary data and exit the program.

Pseudocode

Initialize Accnum,fcount//holds account number and counts


Initialize daysp,daysa,dys_l,dys_e//holds employee attendance
Initialize hourswork//holds hours work
Initialize salary//holds employee salary
Initialize firstname[20]//holds customer first name
Initialize lastname[40]//holds customer last name

Mainmenu()

print____________*Main menu*_______________
print+*************************************+
print* 1:To enter employee's database
print* 2:To enter cashier system.

*
*

print* 3:To see employee of the month.


print* 4:To enter sales database

print* 5:To enter payroll system

print* 6:To enter check out area*


print* 0:To Exit.

print+*************************************+

introscreen()

print+------------------------------+
print|

0000

00

print|

00 00 00

00

00 |

00 00

print|

00 00 00

00 00

print|

00 00 00

00 00

print|

00

0000

00 00

print|

00

000

00 00

print|

00

00

00

00 |

print+------------------------------+
print------------------------------------------------------------------------------printCape Computer science IA, 2015
printcreated by: Jeffrey Mcpherson
print-------------------------------------------------------------------------------

cashiermenu()

system clears screen


print+----------------------------------------------------------+
print|

Welcome To NK WholeSale MENU

print+----------------------------------------------------------+
print+------------------------------------------+
print| 1:Soft Drink

| 21:Total Bill

print+------------------------------------------+
print| 2:Rice

| 22:Cancel Order

print+------------------------------------------+
print| 3: Broom

| 23:To Show Total Sales|

print+------------------------------------------+
print| 4: Hair Gel

| 0:To exit

print+------------------------------------------+
print| 5:Bar Soap

| ----------------------|

print+------------------------------------------+
print| 6:Chicken

| ----------------------|

print+------------------------------------------+
print| 7:Stove

| ----------------------|

print+------------------------------------------+
print| 8:Plasma Tv

| ----------------------|

print+------------------------------------------+

employeeofthemonthtable()

print*************************************************
print*Employee's of the month:D*Congratulation keep up the hard
work*
print*************************************************
print------------------------------------------------printAccount#lastnameFirsttname|
print------------------------------------------------print%d%s%s,Accnum,lastname,firstname
print------------------------------------------------printDays Present:%d,daysp
printDays Absent :%d,daysa
printDays late :%d,dys_l
printDays Early :%d,dys_e
printHours work :%.2f,hourswork
printSalary

:%.2f,salary

print-------------------------------------------------

Initialize billnumque[50]//stores bill number


Initialize cashque[50]//stores the amount paid by customer
Initialize changeque[50]//stores the amount owe to customer
Initialize totalque[50]//stores the total amount from sale
Initialize quantity[50]//stores customer last name

Initialize scsque[50],rclbque[50],bcsque[50],cclbque[50]
Initialize hcsque[50],bscsque[50],stcsque[50],pcsque[50]

Initialize
pricescsque[50],pricerclbque[50],pricebcsque[50],pricehcsque[50]
Initialize
pricebscsque[50],pricecclbque[50],pricestcsque[50],pricepcsque[50]

Initialize i
Initialize a
Initialize ID_rear = -1
Initialize ID_front = -1

Prints receipt
Bill ()
Start

if ID_front == - 1|| ID_front > ID_rear


printNo waiting customer
pause screen for 2 sec

system clears screen

else

for a=ID_fronta <= i a++

print+______________________________________________________________________
+
print|

*Nk**NK......Reciept......NK**NK*

print+______________________________________________________________________
+
t
print+----------------------------------------------------------------------+
printBill#:%d,billnumque[a]
print+______________________________________________________________________
+
printItems

BestbeforePriceQuantityTotal

print+______________________________________________________________________
+

ifscsque[a]!=0
printSoft Drink 10/8/2014$50
print%.2f%.2f,scsque[a],pricescsque[a]

if rclbque[a]!=0
printBluk Rice 10/6/2015$45
print%.2f%.2f,rclbque[a],pricerclbque[a]

if bcsque[a]!=0
printBroom 11/9/2017$200
print%.2f%.2f,bcsque[a],pricebcsque[a]

ifhcsque[a]!=0
printHiar Gel

12/6/2014$20

print%.2f%.2f,hcsque[a],pricehcsque[a]

if bscsque[a]!=0
printBar Soap

9/6/2016$90

print%.2f%.2f,bscsque[a],pricebscsque[a]

ifcclbque[a]!=0
printChicken

10/6/2014$160

print%.2f%.2f,cclbque[a],pricecclbque[a]

ifstcsque[a]!=0

printStove$60000
print%.2f%.2f,stcsque[a],pricestcsque[a]

ifpcsque[a]!=0
printPlasma Tv$90000
print%.2f%.2f,pcsque[a],pricepcsque[a]

print+______________________________________________________________________
+
printTotalCashChange
print$%.2f$%.2f$%.2f,totalque[a],cashque[a],changeque[a]
print----------------------------print----------------------------print***************************Have A Good Day
=D***************************
print+______________________________________________________________________
+
print
print+______________________________________________________________________
+
print+______________________________________________________________________
+
t
print+______________________________________________________________________
+

print+______________________________________________________________________
+

end if
end else
end for
end if
end if
end if
end if
end if
end if
end if
end if

end bill()

Cashier System
cashier()

start

system colour changes to 0b

Initialize custfname[30]
Initialize custlname[30]

Initialize item
Initialize pass,billnum=0

Initialize cash
Initialize change
Initialize amount
Initialize price,total=0,check=0
double Grandtotal=0

Initialize pricescs= 0,pricerclb=0,pricebcs= 0,pricehcs= 0


Initialize pricebscs=0,pricecclb=0,pricestcs=0,pricepcs= 0

Initialize scs= 0
Initialize rclb= 0
Initialize bcs= 0
Initialize hcs= 0
Initialize bscs= 0
Initialize stcs= 0
Initialize cclb= 0
Initialize pcs= 0

Initialize option

Initialize Soft_Drinks,Broom,Hair_Gel,Bar_soap
Initialize Stove,Plasma_Tv
Initialize chicken,Rice

system clears screen


cashiermenu

printEnter The Good ID Number Of Items To Be Purchase:


Read%d,&item
whileitem!=0

FILE *sales
if sales= fopen sales.txt, a+ == NULL
print File could not be opened
printPress any key to continue:
getch

else
select case of item

case 1:

printHow Many Soft Drinks?/For Seal Pack Press 0:


Read%f, &amount
Soft_Drinks = 50.00
price = amount*Soft_Drinks
pricescs+=price

total += price
scs += amount
printAmount of soft drinks purchased %.2f,scs
printThe price is$%0.2f,price
printThe Total is $%0.2f, total
printPress any key to continue:
getch

break
case 2:
printHow Many LB Of Bulk Rice?/For Seal 50KG Pack Press 0?:
Read%f, &amount
Rice = 45.00
price = amount*Rice
pricerclb+=price
total += price
rclb += amount
printAmount of LB Of Bulk Rice purchased %.2f,rclb
printThe price is$%0.2f,price
printThe Total is $%.2f, total
printPress any key to continue:
getch

break

case 3:
printHow Many Broom?/For Seal Pack Press [0]?:

Read%f, &amount
Broom = 200.00
price = amount*Broom
pricebcs+=price
total += price
bcs += amount
printAmount Broom of purchased %.2f,bcs
printThe price is$%0.2f,price
printThe Total is $%.2f, total
printPress any key to continue:
getch

break
case 4:
printHow Many Single Hair Gel?/For Seal Pack Press [0]?:
Read%f, &amount
Hair_Gel = 20.00
price = amount*Hair_Gel
pricehcs+=price
total += price
hcs += amount
printAmount of Single Hair Gelspurchased %.2f,hcs
printThe price is$%0.2f,price
printThe Total is $%.2f, total
printPress any key to continue:
getch

break

case 5:
printHow Many Bar of Soap?/For Seal Pack Press [0]?:
Read%f, &amount
Bar_soap = 90.00
price = amount*Bar_soap
pricebscs+=price
total += price
bscs += amount
printAmount of Bar Soap purchased %.2f,bscs
printThe Price is$%0.2f,price
printThe Total is $%.2f, total
printPress any key to continue:
getch

break

case 6:
printHow Many LB Of Chicken?/For 50lb or more Press 0:
Read%f, &amount
chicken =160.00
price = amount*chicken
pricecclb+=price
total += price
cclb += amount
printAmount of LB of Chicken purchased %.2f,cclb
printThe price is$%0.2f,price
printThe Total is $%.2f, total
printPress any key to continue:

getch

break

case 7:
printHow Many Stove?/For 3 or more press 0:
Read%f, &amount
Stove= 60000.00
price = amount*Stove
pricestcs+=price
total += price
stcs += amount
printAmount of Stove purchased %.2f,stcs
printThe price is$%0.2f,price
printThe Total is $%.2f, total
printPress any key to continue:
getch

break

case 8:
printHow Many Plasma Tv?/For 3 or more press 0:
Read%f, &amount
Plasma_Tv = 90000.00
price = amount*Plasma_Tv
total += price
pcs += amount
pricepcs+=price

printAmount of Plasma Tv purchased %.2f,pcs


printThe price is$%0.2f,price
printThe Total is$%.2f, total
printPress any key to continue:
getch
break

case 21:
system clears screen
print------------------------------------------------------------------print|

*Nk**NK......Reciept......NK**NK*

print------------------------------------------------------------------print|Enter customer first name:|


Read%s,custfname
print|Enter customer last name:|
Read%s,custlname
print------------------------------------------------------------------print|Sub-total:$%.2f
print------------------------------------------------------------------printAmount received:$
Read%f, &cash
printPress any key to continue.
getch
system clears screen
billnum++
system colour changes to 0F
change = cash - total

|,total

print+______________________________________________________________________
+
print|

*Nk**NK......Reciept......NK**NK*

print+______________________________________________________________________
+
t
print+----------------------------------------------------------------------+
printCustomer Name:%s %s,custfname,custlname
printBill#:%d,billnum
print+______________________________________________________________________
+
printItems

BestbeforePriceQuantityTotal

print+______________________________________________________________________
+

ifscs!=0
printSoft Drink 10/8/2014
print%.2f%.2f%.2f,Soft_Drinks,scs,pricescs

ifrclb!=0
printBluk Rice 10/6/2015
print%.2f%.2f%.2f,Rice,rclb,pricerclb

ifbcs!=0

printBroom 11/9/2017
print%.2f%.2f%.2f,Broom,bcs,pricebcs

ifhcs!=0
printHiar Gel

12/6/2014

print%.2f%.2f%.2f,Hair_Gel,hcs,pricehcs

ifbscs!=0
printBar Soap

9/6/2016

print%.2f%.2f%.2f,Bar_soap,bscs,pricebscs

ifcclb!=0
printChicken

10/6/2014

print%.2f%.2f%.2f,chicken,cclb,pricecclb

ifstcs!=0
printStove
print%.2f%.2f%.2f,Stove,stcs,pricestcs

ifpcs!=0
printPlasma Tv

print%.2f%.2f%.2f,Plasma_Tv,pcs,pricepcs

print+______________________________________________________________________
+
printTotalCashChange
print$%.2f$%.2f$%.2f,total,cash,change
print----------------------------print----------------------------print***************************Have A Good Day
=D***************************
print+______________________________________________________________________
+
Grandtotal += total
fprInitializesales,%f%d,total

fclosesales

if ID_rear == 50 - 1
printThere is no customers waiting at the moment
getch

else

if ID_front == - 1

ID_front =0
ID_rear

= ID_rear + 1

billnumque[ID_rear]=billnum
cashque[ID_rear]= cash
changeque[ID_rear]=change
totalque[ID_rear]=total
scsque[ID_rear]=scs
rclbque[ID_rear]=rclb
bcsque[ID_rear]=bcs
hcsque[ID_rear]=hcs
bscsque[ID_rear]=bscs
stcsque[ID_rear]=stcs
cclbque[ID_rear]=cclb
pcsque[ID_rear]=pcs
pricescsque[ID_rear]=pricescs
pricebscsque[ID_rear]=pricebscs
pricerclbque[ID_rear]=pricebcs
pricebcsque[ID_rear]=pricebcs
pricehcsque[ID_rear]=pricehcs
pricepcsque[ID_rear]=pricepcs
pricestcsque[ID_rear]=pricestcs
pricecclbque[ID_rear]=pricecclb

i=ID_rear
a=ID_front

system clears screen


printEnter 1 to view que
Read%d,&option

total=0
scs= 0
rclb= 0
bcs= 0
hcs= 0
bscs= 0
stcs= 0
cclb= 0
pcs= 0
check=0
pricescs= 0,pricerclb=0,pricebcs= 0,pricehcs=0
pricebscs=0,pricecclb=0,pricestcs=0,pricepcs=0

printPress any key to continue:


getch

break
case 22:
total=0
scs= 0
rclb= 0
bcs= 0

hcs= 0
bscs= 0
stcs= 0
cclb= 0
pcs= 0

pricescs= 0,pricerclb=0,pricebcs= 0,pricehcs=0


pricebscs=0,pricecclb=0,pricestcs=0,pricepcs=0
check=0
break
case 23:
printThe Grand Total is $%f,Grandtotal
printPress any key to continue
getch
break
case 24:

break
default:
system clears screen
printYou Have Choosen An Incorrect Option.
printPress any key to continue.
getch
system clears screen
break

cashiermenu ()

printEnter The Good ID Number Of Items purchase:


Read%d,&item
end if
end else
end if
end if
end if
end if
end if
end if
end if
end if
end if
end else
end if

display()
print^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print^

WELCOME TO NK WHOLESALE!

^
print^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

deletee()
start

if ID_front == - 1 || ID_front > ID_rear

printGoods has been dilivered to all customers


getch

else

tprint

|DELIVERED|

print+______________________________________________________________________
+
print|
|

*Nk**NK......Reciept for Collection of Goods......NK**NK*

print+______________________________________________________________________
+
// , t
print+----------------------------------------------------------------------+
printBill#:%d,billnumque[ID_front]
print+______________________________________________________________________
+
printItems

BestbeforePriceQuantityTotal

print+______________________________________________________________________
+

ifscsque[ID_front]!=0
printSoft Drink 10/8/2015$50
print%.2f%.2f,scsque[ID_front],pricescsque[ID_front]

if rclbque[ID_front]!=0
printBluk Rice 10/6/2015$45
print%.2f%.2f,rclbque[ID_front],pricerclbque[ID_front]

if bcsque[ID_front]!=0
printBroom 11/9/2017$200
print%.2f%.2f,bcsque[ID_front],pricebcsque[ID_front]

ifhcsque[ID_front]!=0
printHiar Gel

12/6/2015$20

print%.2f%.2f,hcsque[ID_front],pricehcsque[ID_front]

if bscsque[ID_front]!=0
printBar Soap

9/6/2016$90

print%.2f%.2f,bscsque[ID_front],pricebscsque[ID_front]

ifcclbque[ID_front]!=0
printChicken

10/6/2015$160

print%.2f%.2f,cclbque[ID_front],pricecclbque[ID_front]

ifstcsque[ID_front]!=0
printStove$60000
print%.2f%.2f,stcsque[ID_front],pricestcsque[ID_front]

ifpcsque[ID_front]!=0
printPlasma Tv$90000
print%.2f%.2f,pcsque[ID_front],pricepcsque[ID_front]

print+______________________________________________________________________
+
printTotalCashChange

print$%.2f$%.2f$
%.2f,totalque[ID_front],cashque[ID_front],changeque[ID_front]
print----------------------------print----------------------------print***************************Have A Good Day
=D***************************
print+______________________________________________________________________
+
print
print+______________________________________________________________________
+
print+______________________________________________________________________
+
print+______________________________________________________________________
+
print+______________________________________________________________________
+

ID_front
end if
end else
end if
end if
end if
end if
end if
end if

= ID_front + 1

end if
end if
end else
end if

end delete()

t()
start

time_t systemtime
systemtime = timeNULL
prInitializectime&systemtime

end t()

payrolls()
start
Initialize fcount,Acn,Accnum
Initialize daysp,daysa,dys_l,dys_e
Initialize Option,choice
Initialize baggerRate
Initialize salesclerkRate
Initialize delivery_driver_Rate
Initialize account_Rate

Initialize managerRate
Initialize cashierRate
Initialize sales
Initialize hourswork
Initialize salary
Initialize firstname[20]
Initialize lastname[40]

cashierRate

=187.5

delivery_driver_Rate =190
account_Rate

=300

managerRate

=375

baggerRate

=150

salesclerkRate

=250

fcount

=0

FILE *emplyp

display
print*^^^^^^^^Payroll System^^^^^^^^^*
print^ 1:To delete data on employee's^
print^ 0:To cancel

print*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*
printAre you sure you want to delete all data on employee's?
Read%d,&Acn
select case of Acn
case 1:
if emplyp = fopenemployeedata.txt,w+== NULL

printFile could not be opened.


getch

else
printAll records has been deleted.
printPress enter to continue.
getch
system clears screen

while not end of input


printEnter account ID number 1 to 6 in ASCENDING ORDER:
Read%d,&Accnum
printEnter the amount of days the employee was present:
Read%d,&daysp
printEnter the amount of days the employee was absent:
Read%d,&daysa
printenter days early:
Read%d,&dys_e
printenter days late:
Read%d,&dys_l
printEnter the amount of hours the employee has work:
Read%f,&hourswork

print******** Payroll Menu ********


print*^^^^^^^^^^^^^^^^^^^^^^^^^^^^*
print^ 1: Manager.

print^ 2: Salesclerk.

print^ 3: Cashier.

print^ 4: Bagger.

print^ 5: Delivery Driver.

print^ 6: Accountant.

print^ 7: To cancel.

print*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*

printPlease choose An Option:


Read%d,&Option
select case of Option

case 1:
printYou Have choose Option[1]Manager.
salary = managerRate*hourswork
printThe Manager Salary is $%0.2f,salary
break
case 2:
printYou Have choose Option[2]SalesClerk.
salary = salesclerkRate*hourswork
printThe Salesclerk Salary is $%0.2f,salary
break
case 3:
printYou Have choose Option[3]Cashier.
salary = cashierRate*hourswork
printThe Cashier Salary is $%0.2f,salary
break
case 4:
printYou Have choose Option[4]Bagger.
salary = baggerRate*hourswork

printThe Bagger Salary is $%0.2f,salary


break
case 5:
printYou Have choose Option[5]Delivery Driver.
salary = delivery_driver_Rate*hourswork
printThe Delivery Driver Salary is $%0.2f,salary
break
case 6:
printYou Have choose Option[6]Accountant.
salary = account_Rate*hourswork
printThe Accountant Salary is $%0.2f,salary
break
case 7:
salary=0
break
default:
printYou Have Choosen An Incorrect Option.
printPress enter to continue.
getch
system clears screen
break

printEnter the employee lastname.:


Read%s,lastname
printEnter the employee firstname:
Read%s,firstname
printEnter any number to continue.[ctrlz to end]:
Read%d,&choice

fprInitialize emplyp,%d %s %s %d %d %d %d %.2f


%.2f,Accnum,firstname,lastname,daysp,daysa,dys_e,dys_l,hourswork,salary
system clears screen

fclose emplyp

break

case 0:
printData has not been deleted.
break
default:
printYou Have Choosen An Incorrect Option.
printPress enter to continue.
getch
system clears screen
break
fcloseemplyp

system clears screen


end if
end else
end while
end payrolls()

Displays welcome screen ()

start

Initialize flash
forflash=0flash<=5
while flash!=5
flash++
system colour changes to 0B
display
Initializeroscreen

pause screen for 0.4 seconds


system clears screen
system colour changes to 0A
display
Initializeroscreen
pause screen for 0.4 seconds
system clears screen
end for
end while
end displays welcone sreen()

employeedata
start()
Initialize fcount,Acn,Accnum
Initialize daysp,daysa,dys_l,dys_e
Initialize Option,choice
Initialize baggerRate

Initialize salesclerkRate
Initialize delivery_driver_Rate
Initialize account_Rate
Initialize managerRate
Initialize cashierRate
Initialize sales
Initialize hourswork
Initialize salary
Initialize firstname[20]
Initialize lastname[40]

set cashierRate

=187.5

set delivery_driver_Rate =190


set account_Rate

=300

set managerRate

=375

set baggerRate

=150

set salesclerkRate

=250

set fcount

=0

FILE *emplyp

display
system clears screen
print|-|System database Menu|-|
print*+++++++++++++++++++++++++++++++++++++
++++++*
print+ 1:To read a single employee record.

print+ 2:To read all data stored of employees. +


print+ 0:To exit.

print*+++++++++++++++++++++++++++++++++++++
++++++*
printChoose an option:
Read%d,&choice
system clears screen
whilechoice!=0

select case of choice

case 1:
if emplyp = fopenemployeedata.txt,r== NULL
printFile could not be opened.
printPress any keyto exit.
getch
system clears screen

else
fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

while !feof emplyp


display
printEnter the employee Account number:
Read%d,&Acn

whileAccnum!=Acn&&fcount<=5&&Acn<=6

fcount++
printSearching record:%d,fcount

print>>>>>>
pause screen for 50
print>>>>>>>>>>
pause screen for 50
print>>>>>>>>>>>>>>
pause screen for 50
print>>>>>>>>>>>>>>>>>>
pause screen for 50
system clears screen
printAccount#FirstnameLastnameDays PresentDays AbsentDays
earlyDays lateHours workSalary
print%d%s%s%d%dd%d%%.2f
%.2f,Accnum,firstname,lastname,daysp,daysa,dys_e,dys_l,hourswork,salary
fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

system clears screen


display
ifAccnum==Acn
printAccount has been found.
printGenerating information.>>>
pause screen for 1000
print>>>>>>>>>>>>>>>>>>>>>
pause screen for 1000
print>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
pause screen for 500
system clears screen
display
print-------------------------------------------------

printAccount#lastnameFirsttname|
print------------------------------------------------print%d%s%s,Accnum,lastname,firstname
print------------------------------------------------printDays Present:%d,daysp
printDays Absent :%d,daysa
printDays Early :%d,dys_e
printDays Late :%d,dys_l
printHours work :%.2f,hourswork
printSalary

:%.2f,salary

print------------------------------------------------fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary
printPress enter to continue.
getch
fcount=0

else
printAccount was not found.
printPress enter to continue.
getch
sets fcount to 0

fcloseemplyp
system clears screen
break
case 2:
if emplyp = fopenemployeedata.txt,r== NULL

printFile could not be opened.


printPress any key to exit.
getch
system clears screen

else

display

fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary
while!feofemplyp
print------------------------------------------------printAccount#lastnameFirsttname|
print------------------------------------------------print%d%s%s,Accnum,lastname,firstname
print------------------------------------------------printDays Present:%d,daysp
printDays Absent :%d,daysa
printDays Early :%d,dys_e
printDays Late :%d,dys_l
printHours work :%.2f,hourswork
printSalary

:%.2f,salary

print------------------------------------------------fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

printPress enter to continue.


getch

fcloseemplyp

system clears screen


break
default:
printYou Have Choosen An Incorrect Option.
printPress enter to continue.
getch
system clears screen
break

display
print|-|System database Menu|-|
print*+++++++++++++++++++++++++++++++++++++
++++++*
print+ 1:To read a single employee record.

print+ 2:To read all data stored of employees. +


print+ 0:To exit.

print*+++++++++++++++++++++++++++++++++++++
++++++*

printChoose an option:
Read%d,&choice
system clears screen

end if
end else
end while
end while
end display

end if
end display
end else
end if
end else
end while
end display
end employeedata

employeemonth
start

FILE *emplyp

Initialize cpy1,cpy2,cpy3,cpy4,cpy5,cpy6,cpy7
Initialize Acn

fcount=0

if emplyp = fopenemployeedata.txt,r== NULL


printFile could not be opened.
getch

else

while!feofemplyp
fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary
ifAccnum=1
cpy1 = hourswork
fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

ifAccnum=2
cpy2 = hourswork
fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

ifAccnum=3
cpy3 = hourswork
fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

ifAccnum=4
cpy4 = hourswork
fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

ifAccnum=5
cpy5 = hourswork
fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

ifAccnum=6
cpy6 = hourswork
fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

fcloseemplyp
system clears screen

ifcpy1>=cpy2 && cpy1>=cpy3

Acn =1

ifcpy2>=cpy1 && cpy2>=cpy3


Acn= 2

ifcpy3>=cpy1 && cpy3>=cpy2


Acn= 3

ifcpy4>=cpy5 && cpy4>=cpy6


Acn= 4

ifcpy5>=cpy4 && cpy5>=cpy6


Acn= 5

ifcpy6>=cpy4 && cpy6>=cpy5

Acn =6

if emplyp = fopenemployeedata.txt,r== NULL


printFile could not be opened.
getch

fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary
while !feof emplyp

whileAccnum!=Acn&&fcount<=5&&Acn<=6

fcount++

fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary

system clears screen


display
ifAccnum==Acn

employeeofthemonthtable

fRead emplyp,%d%s%s%d%d%d%d%f
%f,&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,
&salary
printPress enter to continue.
getch
fcount=0
return

else
printAccount was not found.
printPress enter to continue.
getch
fcount=0

fcloseemplyp
system clears screen
end if
end else
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if

end if
end if
end while
end if
end else
end employeedata

sale
FILE *sales

Initialize total
Initialize sale
Initialize option
Initialize choice

set sale to 0

if sales = fopensales.txt,r== NULL


printFile could not be opened.
printPress any key to continue:
getch

else
fReadsales,%f,&total
while!feofsales
sale += total
fReadsales,%f,&total

system clears screen


display
print^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^
print^1:To view total sales made by the cashier for the month. ^
print^2:To erase the amount of sales made by the cashier.
print^0:To Exit.

print^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^
printChoose an option:
Read%d,&option
select case of option
case 1:
printTotal sales made by the Cashier for the month is. $%f,sale
printPress any key to continue:
getch
system clears screen
break
case 2:
system clears screen
display
print*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*
print^ 1:To delete sales made.
print^ 0:To cancel/Exit

^
^

print*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*
printAre you sure you want to delete all data on sales made?
Read%d,&choice

select case of choice


case 1:

if sales = fopensales.txt,w+== NULL


printFile could not be opened.
printpress any key to continue.
getch

else
printSales amount has been deleted.
printPress any key to continue.
getch
set sales to 0

break
case 0:
printSales amount has not been delete.
printPress any key to continue.
getch
break
default:
printYou Have Choosen An Incorrect Option.
printPress any key to continue:
getch
system clears screen
break

case 0:
printExiting. Press any key to continue
getch
break

break

default:
printYou Have Choosen An Incorrect Option.
printPress any key to continue:
getch
system clears screen
break

system clears screen


fclosesales
end if
end else
end while
end if
end else
end sale

Test plan

Input
Screen

Data Input

Purpose of
test

Expected
Results

Data type
accepted by the
program

Welcome screen

Integer

Introduce user to
the program

Welcome screen
will be printed to
the console

Integer

Main menu

Integer

Determine which
option the user
would like to
execute

An option listed
will be executed
chosen and
executed

Integer

Employee
database/payrol

Choose an option

Int choice

Determine which
option the user
would like to
execute

An option listed
will be executed
chosen and
executed

Integer

Enter the
employee
account number

Int Accnum

Store the
employee Account
entered by the user

Searches for the


Account number
within the file.

Integer

Enter the
employee
account number
1to 6

Int Accnum

Store the
employee Account
entered by the user

Store the employee


Account entered
by the user with the
file

Integer

Enter the amount


of days the
employee was
present

Int daysp

Store the days the


employee was
present

Store the days the


employee was
present within the
file

Integer

Enter the amount


of days the
employee was
absent

Int daysa

Store the days the


employee was
absent

Store the days the


employee was
absent within the
file

Integer

Enter days early

Int dys_e

Store the days the


employee was
early

Store the days the


employee was early
with the file

Integer

Enter days late

Int dys_l

Store the days the


employee was late

Store the days the


employee was late
within the file

Integer

Enter the amount


of hours the
employee has
work

Float hourswoek

Store the hours


work by each
employee

Store the hours


work by each
employee with the
file

Float

Choose An
Option

Int option

Determine which
option the user
would like to
execute

An option listed
will be executed
chosen and
executed

Integer

Enter the
employee
lastname

Char lastname[20]

Store employee
last name

Store employee last


name with the file

String

Enter the
employee
firstname

Char firstname[40]

Store employee
first name

Store employee
first name with the
file

String

Choose An
Option

Int option

Determine which
option the user
would like to
execute

An option listed
will be executed
chosen and
executed

Integer

Enter The Good


ID Number Of
Items To Be
Purchase

Int item

Determine which
item the user
would like to
select

An list of items
listed from which
one will be chosen
and executed

Integer

How Many of
item selected

Float amount

Stores amount of
the item user
would like to
purchase

Stores amount of
the item user
would like to
purchase

Float

Enter customer
first name

Char custfname[30]

Stores customer
first name

Stores customer
first name

String

Enter customer
first name

Char custlname[30]

Stores customer
last name

Stores customer
last name

String

Amount received

Float cash

Stores the amount


the customer pays

Stores the amount


the customer pays

Float

Choose An
Option

Int option

Determine which
option the user
would like to
execute

An option listed
will be executed
chosen and
executed

Integer

Are you sure you


want to delete all
data on sales
made?

Int choice

Determine which
option the user
would like to
execute

An option listed
will be executed
chosen and
executed

Integer

Displays receipt
of customer
waiting

Integer

Shows receipt of
customer waiting

Displays receipt

Integer

Deletes receipt
once customer

integer

Shows deleted
receipt

Displays deleted
receipt

Cashier system

Sales database

Check out area

float

Float
Integer

receives goods
Employeeofthe
month
Displays
employee of the
month

integer

Shows employee
of the month

Screen shots of program

Welcome screen

Displays employee
of the month

Integer

Main menu

option 1 was chose which enters system database


menu

Enters 1

1 was chosen. User prompt to enter account


number

Account found

Displays account

Return to main menu enters option 2

Cashier menu

Sale is made

21 entered

Customer name is entered

Amount received from customer is entered

Prints receipt

Return to main menu option 3 is chosen

Shows employee of the month

Enters sales data base

Option 1 is chosen shows total sales

Option 0 is chosen saves and close files exit


program

Program
//Name:Jeffrey Mcpherson
//Candidate # :

1000331676

//School

Excelsior High School

//Territory

Jamaica

//Year
//Subject

May/June 2015
:

Computer Science Unit 2

//=======================================================
=====================
//

==========[ LIBRARIES ]==========

//=======================================================
=====================

#include<stdio.h>

#include<stdlib.h>
#include<conio.h>
#include<time.h>
#include<string.h>
#define MAX 50
//=======================================================
=====================
//Functuons //
void employeeofthemonthtable();
void cashiermenu();//Displays cashier menu
void introscreen();//displays welcome screen
void Mainmenu();//displays mainmenu
void t();//time function
void cahier ();//cashier system function
void Welcome();//welcome screen function
void display();//header function
void employeedata();//function to store data on staff
void employeemonth();//employee of the month function
void sale();//fuction to show total sales
void payrolls();//function to calculate employee saary
void bill();//displays bill for customer in waiting area

int

Accnum,fcount;//holds account number and counts

int

daysp,daysa,dys_l,dys_e;//holds employee attendance

float hourswork;//holds hours work


float salary;//holds employee salary
char firstname[20];//holds customer first name
char lastname[40];//holds customer last name

void Mainmenu()//displays mainmenu


{
printf("\n\t____________*Main menu*_______________\n");

printf("\t+*************************************+\n");
printf("\t* 1:To enter employee's database
printf("\t* 2:To enter cashier system.

*\n");
*\n");

printf("\t* 3:To see employee of the month.


printf("\t* 4:To enter sales database

*\n");

printf("\t* 5:To enter payroll system

*\n");

*\n");

printf("\t* 6:To enter check out area*\n");


printf("\t* 0:To Exit.

*\n");

printf("\t+*************************************+\n");
}

void introscreen()//displays introduction screen


{
printf("\t\t\t+------------------------------+\n");
printf("\t\t\t|

0000

00

00

printf("\t\t\t|

00 00

00

00

printf("\t\t\t|

00 00 00

00 00

|\n");

printf("\t\t\t|

00

00 00

00 00

|\n");

printf("\t\t\t|

00

0000

00 00

|\n");

printf("\t\t\t|

00

000

printf("\t\t\t|

00

00

00
00

00
00

00
00

|\n");
|\n");

|\n");
|\n");

printf("\t\t\t+------------------------------+\n\n\n\n\n");
printf("-------------------------------------------------------------------------------\n");
printf("Cape Computer science IA, 2015\n");
printf("\n\ncreated by: Jeffrey Mcpherson\n");
printf("-------------------------------------------------------------------------------\n");
}

void cashiermenu()//displays menu for cashier system


{
system("cls");
printf("\n\t+----------------------------------------------------------+\n");
printf("\t|

Welcome To NK WholeSale MENU

|\n");

printf("\t+----------------------------------------------------------+\n");
printf("\t\t+------------------------------------------+\n");
printf("\t\t| 1:Soft Drink

| 21:Total Bill

|\n");

printf("\t\t+------------------------------------------+\n");
printf("\t\t| 2:Rice

| 22:Cancel Order

|\n");

printf("\t\t+------------------------------------------+\n");
printf("\t\t| 3: Broom

| 23:To Show Total Sales|\n");

printf("\t\t+------------------------------------------+\n");
printf("\t\t| 4: Hair Gel

| 0:To exit

|\n");

printf("\t\t+------------------------------------------+\n");
printf("\t\t| 5:Bar Soap

| ----------------------|\n");

printf("\t\t+------------------------------------------+\n");
printf("\t\t| 6:Chicken

| ----------------------|\n");

printf("\t\t+------------------------------------------+\n");
printf("\t\t| 7:Stove

| ----------------------|\n");

printf("\t\t+------------------------------------------+\n");
printf("\t\t| 8:Plasma Tv

| ----------------------|\n");

printf("\t\t+------------------------------------------+\n");
}

void employeeofthemonthtable()//displays table of employee of the month


{
printf("*************************************************\n");
printf("*Employee's of the month:D\t\t\t*\nCongratulation keep up the
hard work\t\t*\n");
printf("*************************************************\n");
printf("-------------------------------------------------\n");
printf("Account#\tlastname\tFirsttname\t|\n");
printf("-------------------------------------------------\n");
printf("%d\t\t%s\t\t%s\n",Accnum,lastname,firstname);
printf("-------------------------------------------------\n");
printf("Days Present:%d\n",daysp);

printf("Days Absent :%d\n",daysa);


printf("Days late

:%d\n",dys_l);

printf("Days Early :%d\n",dys_e);


printf("Hours work :%.2f\n",hourswork);
printf("Salary

:%.2f\n",salary);

printf("-------------------------------------------------\n");
}

int

billnumque[MAX];//stores bill number

float cashque[MAX];//stores the amount paid by customer


float changeque[MAX];//stores the amount owe to customer
float totalque[MAX];//stores the total amount from sale
float quantity[MAX];//stores customer last name
//=======================================================
===============================//
//stores quantity//
float scsque[MAX],rclbque[MAX],bcsque[MAX],cclbque[MAX];
float hcsque[MAX],bscsque[MAX],stcsque[MAX],pcsque[MAX];
//=======================================================
===========================//
//=======================================================
==========================//
//Stores prices//
float
pricescsque[MAX],pricerclbque[MAX],pricebcsque[MAX],pricehcsque[MAX];
float
pricebscsque[MAX],pricecclbque[MAX],pricestcsque[MAX],pricepcsque[MAX];
//=======================================================
=======================//

int i;//acts as a counter


int a;//acts as a counter holds subscript for array
int ID_rear = -1;//use as array subscript
int ID_front = -1;//use as array subscript

void Bill(){
if (ID_front == - 1|| ID_front > ID_rear){//condition test if queue(customers
waiting) is empty
printf("No waiting customer\n");
sleep(2000);//screen pause for 2 seconds
system("cls");//clears system screen
}
else
{
for (a=ID_front;a <= i; a++)
{

printf("+______________________________________________________________________+\n");
printf("|

*Nk**NK......Reciept......NK**NK*

|\n");

printf("+______________________________________________________________________+\n\n");
t();
printf("+----------------------------------------------------------------------+\n\n");
printf("Bill#:%d\n",billnumque[a]);//prints bill number
printf("+______________________________________________________________________+\n");
printf("Item(s)

Bestbefore\tPrice\t\tQuantity\tTotal\n");

printf("+______________________________________________________________________+\n");
//=======================================================
===============================================//
//Test if quantity is not equal to zero prints items to receiept if not//
if(scsque[a]!=0){
printf("Soft Drink\t 10/8/2014\t$50\t");
printf("\t%.2f\t\t%.2f\n",scsque[a],pricescsque[a]);
}

if( rclbque[a]!=0){
printf("Bluk Rice\t 10/6/2015\t$45\t");

printf("\t%.2f\t\t%.2f\n",rclbque[a],pricerclbque[a]);
}

if( bcsque[a]!=0){
printf("Broom \t\t 11/9/2017\t$200\t");
printf("\t%.2f\t\t%.2f\n",bcsque[a],pricebcsque[a]);
}

if(hcsque[a]!=0){
printf("Hiar Gel \t 12/6/2014\t$20\t");
printf("\t%.2f\t\t%.2f\n",hcsque[a],pricehcsque[a]);
}

if( bscsque[a]!=0){
printf("Bar Soap \t

9/6/2016\t$90\t");

printf("\t%.2f\t\t%.2f\n",bscsque[a],pricebscsque[a]);
}

if(cclbque[a]!=0){
printf("Chicken

\t 10/6/2014\t$160\t");

printf("\t\t%.2f\t\t%.2f\n",cclbque[a],pricecclbque[a]);
}

if(stcsque[a]!=0){
printf("Stove\t\t\t\t$60000");
printf("\t\t%.2f\t\t%.2f\n",stcsque[a],pricestcsque[a]);
}

if(pcsque[a]!=0){
printf("Plasma Tv\t\t\t$90000");
printf("\t%.2f\t\t%.2f\n",pcsque[a],pricepcsque[a]);

}
//=======================================================
=======================================================
====//
printf("+______________________________________________________________________+\n");
printf("\t\t\tTotal\t\tCash\t\tChange\n");
printf("\t\t\t$%.2f\t\t$%.2f\t\t$
%.2f\n",totalque[a],cashque[a],changeque[a]);//prints total cash and change
printf("\t\t\t---------\t----------\t----------\n");
printf("\t\t\t---------\t----------\t----------\n");
printf("***************************Have A Good Day
=D***************************\n");
printf("+______________________________________________________________________+\n");
printf("\n\n\n");
printf("+______________________________________________________________________+\n");
printf("+______________________________________________________________________+\n");
t();//displays system time
printf("+______________________________________________________________________+\n");
printf("+______________________________________________________________________+\n");

}
}
}//end of d

void cashier()//casheir function

{
system("color 0b");//change system colour

char custfname[30];//stores customer first name


char custlname[30];//stores customer last name

int item;//Item choice


int pass,billnum=0;//sets bill number to zero and acts as a counter

float cash;//holds the amount paid by customer


float change;//holds the amount owe to customer
float amount;//holds the amount the customer pays
float price,total=0,check=0;//holds price total and check
double Grandtotal=0;//holds grandtotal
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++
//sets the price to zero.
float pricescs= 0,pricerclb=0,pricebcs= 0,pricehcs= 0;
float pricebscs=0,pricecclb=0,pricestcs=0,pricepcs= 0;

//+++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++
//sets quqntity to zero
float scs= 0;
float rclb= 0;
float bcs= 0;
float hcs= 0;
float bscs= 0;
float stcs= 0;
float cclb= 0;
float pcs= 0;

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++

int option;//holds user chice


float Soft_Drinks,Broom,Hair_Gel,Bar_soap;//holds item price
float Stove,Plasma_Tv;//holds item price
float chicken,Rice;//holds item price

system("cls");//clear system screen


cashiermenu(); //displays cashier menu

printf("Enter The Good ID Number Of Items To Be Purchase: ");


scanf("%d",&item);//holds item choice
while(item!=0)
{
FILE *sales; //File pointer
if( (sales= fopen( "sales.txt", "a+" )) == NULL ) {//appends sales file
printf( "File could not be opened\n" );
printf("Press any key to continue:");
getch();//gets any character
}
else{
switch(item)//switch chose case base off item choosen by user
{
//
=======================================================
===================================//
//1 takes amount from user and calculates cost of items needed//
case 1:

printf("How Many Soft Drinks?/For Seal Pack Press 0:");


scanf("%f", &amount);
Soft_Drinks = 50.00;

price = amount*Soft_Drinks;
pricescs+=price;
total += price;
scs += amount;
printf("Amount of soft drinks purchased %.2f\n",scs);
printf("The price is$%0.2f\n",price);
printf("The Total is $%0.2f\n", total);
printf("Press any key to continue:");
getch();

break;
case 2:
printf("How Many LB Of Bulk Rice?/For Seal 50KG Pack Press 0?:");
scanf("%f", &amount);
Rice = 45.00;
price = amount*Rice;
pricerclb+=price;
total += price;
rclb += amount;
printf("Amount of LB Of Bulk Rice purchased %.2f\n",rclb);
printf("The price is$%0.2f\n",price);
printf("The Total is $%.2f\n", total);
printf("Press any key to continue:");
getch();

break;

case 3:
printf("How Many Broom?/For Seal Pack Press [0]?:");
scanf("%f", &amount);
Broom = 200.00;
price = amount*Broom;

pricebcs+=price;
total += price;
bcs += amount;
printf("Amount Broom of purchased %.2f\n",bcs);
printf("The price is$%0.2f\n",price);
printf("The Total is $%.2f\n", total);
printf("Press any key to continue:");
getch();

break;
case 4:
printf("How Many Single Hair Gel?/For Seal Pack Press [0]?:");
scanf("%f", &amount);
Hair_Gel = 20.00;
price = amount*Hair_Gel;
pricehcs+=price;
total += price;
hcs += amount;
printf("Amount of Single Hair Gel(s)purchased %.2f\n",hcs);
printf("The price is$%0.2f\n",price);
printf("The Total is $%.2f\n", total);
printf("Press any key to continue:");
getch();

break;
case 5:
printf("How Many Bar of Soap?/For Seal Pack Press [0]?:");
scanf("%f", &amount);
Bar_soap = 90.00;
price = amount*Bar_soap;
pricebscs+=price;
total += price;
bscs += amount;

printf("Amount of Bar Soap purchased %.2f\n",bscs);


printf("The Price is$%0.2f\n",price);
printf("The Total is $%.2f\n", total);
printf("Press any key to continue:");
getch();

break;

case 6:
printf("How Many LB Of Chicken?/For 50lb or more Press 0:");
scanf("%f", &amount);
chicken =160.00;
price = amount*chicken;
pricecclb+=price;
total += price;
cclb += amount;
printf("Amount of LB of Chicken purchased %.2f\n",cclb);
printf("The price is$%0.2f\n",price);
printf("The Total is $%.2f\n", total);
printf("Press any key to continue:");
getch();

break;

case 7:
printf("How Many Stove?/For 3 or more press 0:");
scanf("%f", &amount);
Stove= 60000.00;
price = amount*Stove;
pricestcs+=price;
total += price;
stcs += amount;
printf("Amount of Stove purchased %.2f\n",stcs);

printf("The price is$%0.2f\n",price);


printf("The Total is $%.2f\n", total);
printf("Press any key to continue:");
getch();

break;

case 8:
printf("How Many Plasma Tv?/For 3 or more press 0:");
scanf("%f", &amount);
Plasma_Tv = 90000.00;
price = amount*Plasma_Tv;
total += price;
pcs += amount;
pricepcs+=price;
printf("Amount of Plasma Tv purchased %.2f\n",pcs);
printf("The price is$%0.2f\n",price);
printf("The Total is$%.2f\n", total);
printf("Press any key to continue:");
getch();
break;
//=======================================================
=======================================================
==============//
case 21:
system("cls");
printf("-------------------------------------------------------------------\n");
printf("|

*Nk**NK......Reciept......NK**NK*

|\n");

printf("-------------------------------------------------------------------\n");
printf("|Enter customer first name:|");
scanf("%s",custfname);// customer first name
printf("|Enter customer last name:|");
scanf("%s",custlname); //customer last name
printf("-------------------------------------------------------------------\n");

printf("|Sub-total:$%.2f

|\n",total);

printf("-------------------------------------------------------------------\n");
printf("Amount received:$");
scanf("%f", &cash);//amount received from customer
printf("Press any key to continue.");
getch();
system("cls");
billnum++;
system("color 0F");
change = cash - total;//calculates change
printf("+______________________________________________________________________+\n");
printf("|

*Nk**NK......Reciept......NK**NK*

|\n");

printf("+______________________________________________________________________+\n\n");
t();
printf("+----------------------------------------------------------------------+\n\n");
printf("Customer Name:%s %s\n\n",custfname,custlname);//names
printf("Bill#:%d\n",billnum);//bill number
printf("+______________________________________________________________________+\n");
printf("Item(s)

Bestbefore\tPrice\t\tQuantity\tTotal\n");

printf("+______________________________________________________________________+\n");
//=======================================================
=======================================================
=====================//
//Test of quantity is not equal to zero.//
if(scs!=0){
printf("Soft Drink\t 10/8/2014\t");
printf("%.2f\t\t%.2f\t\t%.2f\n",Soft_Drinks,scs,pricescs);
}

if(rclb!=0){
printf("Bluk Rice\t 10/6/2015\t");

printf("%.2f\t\t%.2f\t\t%.2f\n",Rice,rclb,pricerclb);
}

if(bcs!=0){
printf("Broom \t\t 11/9/2017\t");
printf("%.2f\t\t%.2f\t\t%.2f\n",Broom,bcs,pricebcs);
}

if(hcs!=0){
printf("Hiar Gel \t 12/6/2014\t");
printf("%.2f\t\t%.2f\t\t%.2f\n",Hair_Gel,hcs,pricehcs);
}

if(bscs!=0){
printf("Bar Soap \t

9/6/2016\t");

printf("%.2f\t\t%.2f\t\t%.2f\n",Bar_soap,bscs,pricebscs);
}

if(cclb!=0){
printf("Chicken

\t 10/6/2014\t");

printf("%.2f\t\t%.2f\t\t%.2f\n",chicken,cclb,pricecclb);
}

if(stcs!=0){
printf("Stove\t\t\t\t");
printf("%.2f\t%.2f\t\t%.2f\n",Stove,stcs,pricestcs);
}

if(pcs!=0){
printf("Plasma Tv\t\t\t");

printf("%.2f\t%.2f\t\t%.2f\n",Plasma_Tv,pcs,pricepcs);
}

printf("+______________________________________________________________________+\n");
printf("\t\t\tTotal\t\tCash\t\tChange\n");
printf("\t\t\t$%.2f\t\t$%.2f\t\t$%.2f\n",total,cash,change);//prints total
cash and change
printf("\t\t\t---------\t----------\t----------\n");
printf("\t\t\t---------\t----------\t----------\n");
printf("***************************Have A Good Day
=D***************************\n");
printf("+______________________________________________________________________+\n");
Grandtotal += total;//sums total sale
fprintf(sales,"%f%d\n",total); //prins total to file

fclose(sales);//close sales file


if (ID_rear == MAX - 1){
printf("There is no customers waiting at the moment\n");
getch();//gwt
}
else
{
if (ID_front == - 1)
/*If line is empty */
ID_front =0;
ID_rear = ID_rear + 1;
//=======================================================
=======================================//
//cpoyies holding information/data to storage in memory //
billnumque[ID_rear]=billnum;
cashque[ID_rear]= cash;
changeque[ID_rear]=change ;
totalque[ID_rear]=total;

scsque[ID_rear]=scs;
rclbque[ID_rear]=rclb;
bcsque[ID_rear]=bcs;
hcsque[ID_rear]=hcs;
bscsque[ID_rear]=bscs;
stcsque[ID_rear]=stcs;
cclbque[ID_rear]=cclb;
pcsque[ID_rear]=pcs;
pricescsque[ID_rear]=pricescs;
pricebscsque[ID_rear]=pricebscs;
pricerclbque[ID_rear]=pricebcs;
pricebcsque[ID_rear]=pricebcs;
pricehcsque[ID_rear]=pricehcs;
pricepcsque[ID_rear]=pricepcs;
pricestcsque[ID_rear]=pricestcs;
pricecclbque[ID_rear]=pricecclb;

i=ID_rear;// copy of ID_rear


a=ID_front;//copy of ID_front
//=======================================================
=====================================//
}//end of els
total=0;// sets total to zero
//=======================================================
===================================//
//Sets quanities and price to zero//
rclb= 0,bcs=0,scs=0,pcs=0;
hcs=0,bscs=0,stcs=0,cclb=0;

check=0;
pricescs= 0,pricerclb=0,pricebcs= 0,pricehcs=0;
pricebscs=0,pricecclb=0,pricestcs=0,pricepcs=0;

//=======================================================
====================================//
printf("Press any key to continue:");
getch ();

break;
case 22:
//=======================================================
===============================================//
//cancels bill//
total=0;
scs= 0;
rclb= 0;
bcs= 0;
hcs= 0;
bscs= 0;
stcs= 0;
cclb= 0;
pcs= 0;

pricescs= 0,pricerclb=0,pricebcs= 0,pricehcs=0;


pricebscs=0,pricecclb=0,pricestcs=0,pricepcs=0;
check=0;
//=======================================================
================================================//
break;
case 23:
printf("The Grand Total is $%f\n",Grandtotal);//total of all bills
printf("Press any key to continue \n");
getch();
break;
default:
system("cls");
printf("You Have Choosen An Incorrect Option.\n");

printf("Press any key to continue.");


getch();
system("cls");
break;
}
cashiermenu(); //displays cashier menu

printf("Enter The Good ID Number Of Items purchase: ");


scanf("%d",&item);
}
}
}

void display(){//display header


printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
^\n");

printf("^

WELCOME TO NK WHOLESALE!

printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n");
}

void deletee()//delete bill once custer has received goods


{
if (ID_front == - 1 || ID_front > ID_rear )
{
printf("Goods has been dilivered to all customers \n");
getch();

}
else
{
t();

printf("

|DELIVERED|

\n");

printf("+______________________________________________________________________+\n");
printf("|

*Nk**NK......Reciept for Collection of Goods......NK**NK*

|\n");
printf("+______________________________________________________________________+\n\n");
printf("+----------------------------------------------------------------------+\n\n");
printf("Bill#:%d\n",billnumque[ID_front]);
printf("+______________________________________________________________________+\n");
printf("Item(s)

Bestbefore\tPrice\t\tQuantity\tTotal\n");

printf("+______________________________________________________________________+\n");

if(scsque[ID_front]!=0){
printf("Soft Drink\t 10/8/2015\t$50\t");
printf("\t%.2f\t\t%.2f\n",scsque[ID_front],pricescsque[ID_front]);
}

if( rclbque[ID_front]!=0){
printf("Bluk Rice\t 10/6/2015\t$45\t");
printf("\t%.2f\t\t%.2f\n",rclbque[ID_front],pricerclbque[ID_front]);
}

if( bcsque[ID_front]!=0){
printf("Broom \t\t 11/9/2017\t$200\t");
printf("\t%.2f\t\t%.2f\n",bcsque[ID_front],pricebcsque[ID_front]);
}

if(hcsque[ID_front]!=0){
printf("Hiar Gel \t 12/6/2015\t$20\t");
printf("\t%.2f\t\t%.2f\n",hcsque[ID_front],pricehcsque[ID_front]);
}

if( bscsque[ID_front]!=0){
printf("Bar Soap \t

9/6/2016\t$90\t");

printf("\t%.2f\t\t%.2f\n",bscsque[ID_front],pricebscsque[ID_front]);
}

if(cclbque[ID_front]!=0){
printf("Chicken

\t 10/6/2015\t$160\t");

printf("\t%.2f%.2f\n",cclbque[ID_front],pricecclbque[ID_front]);
}

if(stcsque[ID_front]!=0){
printf("Stove\t\t\t\t$60000");
printf("\t\t%.2f\t\t%.2f\n",stcsque[ID_front],pricestcsque[ID_front]);
}

if(pcsque[ID_front]!=0){
printf("Plasma Tv\t\t\t$90000");
printf("\t\t%.2f\t\t%.2f\n",pcsque[ID_front],pricepcsque[ID_front]);
}

printf("+______________________________________________________________________+\n");
printf("\t\t\tTotal\t\tCash\t\tChange\n");
printf("\t\t\t$%.2f\t\t$%.2f\t\t$
%.2f\n",totalque[ID_front],cashque[ID_front],changeque[ID_front]);
printf("\t\t\t---------\t----------\t----------\n");
printf("\t\t\t---------\t----------\t----------\n");
printf("***************************Have A Good Day
=D***************************\n");
printf("+______________________________________________________________________+\n");
printf("\n\n\n");

printf("+______________________________________________________________________+\n");
printf("+______________________________________________________________________+\n");
printf("+______________________________________________________________________+\n");
printf("+______________________________________________________________________+\n");

ID_front = ID_front + 1; //removes bill

}
} /*End of delete() */

void t()//time function


{
time_t systemtime;
systemtime = time(NULL);
printf(ctime(&systemtime));
}

void payrolls()
{
int

fcount,Acn,Accnum;

int

daysp,daysa,dys_l,dys_e;

int

Option,choice;

float baggerRate;
float salesclerkRate;
float delivery_driver_Rate;
float account_Rate;
float managerRate;
float cashierRate;

float sales;
float hourswork;
float salary;
char firstname[20];
char lastname[40];
//=======================================================
========================//
// sets rates//
cashierRate

=187.5;

delivery_driver_Rate =190;
account_Rate

=300;

managerRate

=375;

baggerRate

=150;

salesclerkRate

=250;

fcount

=0;

//-------------------------------------------------------------------------------//
FILE *emplyp;//file pointer

display();
printf("\t\t\t*^^^^^^^^Payroll System^^^^^^^^^*\n");
printf("\t\t\t^ 1:To delete data on employee's^\n");
printf("\t\t\t^ 0:To cancel

^\n");

printf("\t\t\t*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*\n");
printf("Are you sure you want to delete all data on employee's?");
scanf("%d",&Acn);
switch(Acn){
case 1:
if ((emplyp = fopen("employeedata.txt","w+"))== NULL){

printf("File could not be opened.\n");


getch();
}
else{

printf("All records has been deleted.\n");


printf("Press enter to continue.\n");
getch() ;
system("cls");
//===============enters data for
employees================================//
//===============calculates employee
salary==============================//
while(!feof(stdin) ){
printf("Enter account ID number 1 to 6 in ASCENDING ORDER:");
scanf("%d",&Accnum);
printf("Enter the amount of days the employee was present:");
scanf("%d",&daysp);
printf("Enter the amount of days the employee was absent:");
scanf("%d",&daysa);
printf("enter days early:");
scanf("%d",&dys_e);
printf("enter days late:");
scanf("%d",&dys_l);
printf("Enter the amount of hours the employee has work:");
scanf("%f",&hourswork);

printf("\t\t\t******** Payroll Menu ********\n");


printf("\t\t\t*^^^^^^^^^^^^^^^^^^^^^^^^^^^^*\n");
printf("\t\t\t^ 1: Manager.

^\n");

printf("\t\t\t^ 2: Salesclerk.

^\n");

printf("\t\t\t^ 3: Cashier.

^\n");

printf("\t\t\t^ 4: Bagger.

^\n");

printf("\t\t\t^ 5: Delivery Driver.

^\n");

printf("\t\t\t^ 6: Accountant.

^\n");

printf("\t\t\t^ 7: To cancel.

^\n");

printf("\t\t\t*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*\n");

printf("Please choose An Option:");

scanf("%d",&Option);
switch(Option){

case 1:
printf("You Have choose Option[1]Manager.\n");
salary = managerRate*hourswork;
printf("The Manager Salary is $%0.2f\n",salary);
break;
case 2:
printf("You Have choose Option[2]SalesClerk.\n");
salary = salesclerkRate*hourswork;
printf("The Salesclerk Salary is $%0.2f\n",salary);
break;
case 3:
printf("You Have choose Option[3]Cashier.\n");
salary = cashierRate*hourswork;
printf("The Cashier Salary is $%0.2f\n",salary);
break;
case 4:
printf("You Have choose Option[4]Bagger.\n");
salary = baggerRate*hourswork;
printf("The Bagger Salary is $%0.2f\n",salary);
break;
case 5:
printf("You Have choose Option[5]Delivery Driver.\n");
salary = delivery_driver_Rate*hourswork;
printf("The Delivery Driver Salary is $%0.2f\n",salary);
break;
case 6:
printf("You Have choose Option[6]Accountant.\n");
salary = account_Rate*hourswork;
printf("The Accountant Salary is $%0.2f\n",salary);
break;

case 7:
salary=0;
break;
default:
printf("You Have Choosen An Incorrect Option.\n");
printf("Press enter to continue.");
getch();
system("cls");
break;
}
printf("Enter the employee lastname.:");
scanf("%s",lastname);
printf("Enter the employee firstname:");
scanf("%s",firstname);
printf("Enter any number to continue.[ctrlz to end]:");
scanf("%d",&choice);
fprintf( emplyp,"%d %s %s %d %d %d %d %.2f
%.2f\n",Accnum,firstname,lastname,daysp,daysa,dys_e,dys_l,hourswork,salary);//
prints to file
system("cls");
}
fclose(emplyp);
}

break;

case 0:
printf("Data has not been deleted.\n");
break;
default:
printf("You Have Choosen An Incorrect Option.\n");
printf("Press enter to continue.");
getch();
system("cls");

break;
fclose(emplyp);

}
system("cls");
}
//=======================================================
=======================================//
void Welcome(){//displays welcome screen
int flash;//counter
for(flash=0;flash<=5;){
while (flash!=5 ){
flash++;
system("color 0B");//changs text colour
display ();
introscreen();

sleep(400);//pauses screen for 0.40seconds


system("cls");
system("color 0A");//changs text colour
display ();
introscreen();
sleep(400);//pauses screen for 0.40seconds
system("cls");
}
return;
}
}
void employeedata(){
int

fcount,Acn,Accnum;

int

daysp,daysa,dys_l,dys_e;

int

Option,choice;

float salary;

char firstname[20];
char lastname[40];

FILE *emplyp;//file pointer

display ();
system("cls");
printf("\n\t\t\t|-|System database Menu|-|\n");
++*\n");

printf("\t\t*+++++++++++++++++++++++++++++++++++++++++
printf("\t\t+ 1:To read a single employee record.
printf("\t\t+ 2:To read all data stored of employees.
printf("\t\t+ 0:To exit.

+\n");
+\n");

+\n");

printf("\t\t*+++++++++++++++++++++++++++++++++++++++++
++*\n");
printf("Choose an option:");
scanf("%d",&choice);
system("cls");
while(choice!=0){

switch(choice){

case 1:
if ((emplyp = fopen("employeedata.txt","r"))== NULL){//reads from file
printf("File could not be opened.\n");
printf("Press any keyto exit.");
getch();
system("cls");
}
else{
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);//scans from file

while ( !feof( emplyp ) ){//reads until end of file


display();
printf("Enter the employee Account number:");
scanf("%d",&Acn);

while(Accnum!=Acn&&fcount<=5&&Acn<=6){ //searches for account number

fcount++;
printf("Searching record:%d\n",fcount);
printf(">>>>>>");
sleep(50);
printf(">>>>>>>>>>");
sleep(50);
printf(">>>>>>>>>>>>>>");
sleep(50);
printf(">>>>>>>>>>>>>>>>>>");
sleep(50);
system("cls");
printf("Account#\tFirstname\tLastname\tDays Present\tDays
Absent\tDays early\tDays late\tHours work\tSalary\n");
printf("%d\t\t%s\t\t%s\t%d\t\t%d\t\td%\td%\t%.2f\t\t
%.2f\n",Accnum,firstname,lastname,daysp,daysa,dys_e,dys_l,hourswork,salary);
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);//scans from file
}
system("cls");
display();
if(Accnum==Acn){
printf("Account has been found.\n");
printf("Generating information.>>>");
sleep(1000);
printf(">>>>>>>>>>>>>>>>>>>>>");

sleep(1000);
printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
sleep(500);
system("cls");
display();
printf("-------------------------------------------------\n");
printf("Account#\tlastname\tFirsttname\t|\n");
printf("-------------------------------------------------\n");
printf("%d\t\t%s\t\t%s\n",Accnum,lastname,firstname);
printf("-------------------------------------------------\n");
printf("Days Present:%d\n",daysp);
printf("Days Absent :%d\n",daysa);
printf("Days Early :%d\n",dys_e);
printf("Days Late

:%d\n",dys_l);

printf("Hours work :%.2f\n",hourswork);


printf("Salary

:%.2f\n",salary);

printf("-------------------------------------------------\n");
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
printf("Press enter to continue.\n");
getch();
fcount=0;
}
else{
printf("Account was not found.\n");
printf("Press enter to continue.\n");
getch();
fcount=0;
}
fclose(emplyp);
system("cls");
break;
case 2:

//======reads out all employee records ======//


if ((emplyp = fopen("employeedata.txt","r"))== NULL){
printf("File could not be opened.\n");
printf("Press any key to exit.");
getch();
system("cls");
}
else{

display();

fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
while(!feof(emplyp)){
printf("-------------------------------------------------\n");
printf("Account#\tlastname\tFirsttname\t|\n");
printf("-------------------------------------------------\n");
printf("%d\t\t%s\t\t%s\n",Accnum,lastname,firstname);
printf("-------------------------------------------------\n");
printf("Days Present:%d\n",daysp);
printf("Days Absent :%d\n",daysa);
printf("Days Early :%d\n",dys_e);
printf("Days Late

:%d\n",dys_l);

printf("Hours work :%.2f\n",hourswork);


printf("Salary

:%.2f\n",salary);

printf("-------------------------------------------------\n");
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
}
printf("Press enter to continue.\n");
getch();
}
fclose(emplyp);
system("cls");
break;
default:

printf("You Have Choosen An Incorrect Option.\n");


printf("Press enter to continue.");
getch();
system("cls");
break;

}
}
}
display();
printf("\n\t\t\t|-|System database Menu|-|\n");
printf("\t\t*++++++++++++++++++++++++++++++++++++++++++
+*\n");
printf("\t\t+ 1:To read a single employee record.
printf("\t\t+ 2:To read all data stored of employees.
printf("\t\t+ 0:To exit.
+*\n");

+\n");
+\n");

+\n");

printf("\t\t*++++++++++++++++++++++++++++++++++++++++++

printf("Choose an option:");
scanf("%d",&choice);
system("cls");
}
}

void employeemonth();
void employeemonth()
{
FILE *emplyp;

int

cpy1,cpy2,cpy3,cpy4,cpy5,cpy6,cpy7;

int Acn;

fcount=0;

if ((emplyp = fopen("employeedata.txt","r"))== NULL){


printf("File could not be opened.\n");
getch();
}
else{
//copying hours work to a different location for processing//
while(!feof(emplyp)){
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
if(Accnum=1){
cpy1 = hourswork;
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
}
if(Accnum=2){
cpy2 = hourswork;
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
}
if(Accnum=3){
cpy3 = hourswork;
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
}
if(Accnum=4){
cpy4 = hourswork;

fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
}
if(Accnum=5){
cpy5 = hourswork;
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
}
if(Accnum=6){
cpy6 = hourswork;
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
}
}

fclose(emplyp);
system("cls");
//makes comparison of data that was copied to new location//
if(cpy1>=cpy2 && cpy1>=cpy3){

Acn =1;
}
if(cpy2>=cpy1 && cpy2>=cpy3){
Acn= 2;
}
if(cpy3>=cpy1 && cpy3>=cpy2){
Acn= 3;
}
if(cpy4>=cpy5 && cpy4>=cpy6){
Acn= 4;
}
if(cpy5>=cpy4 && cpy5>=cpy6){

Acn= 5;
}
if(cpy6>=cpy4 && cpy6>=cpy5){
Acn =6;
}

if ((emplyp = fopen("employeedata.txt","r"))== NULL){


printf("File could not be opened.\n");
getch();
}
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
while ( !feof( emplyp ) ){
display();

while(Accnum!=Acn&&fcount<=5&&Acn<=6){

fcount++;

fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);
}
system("cls");
display();
if(Accnum==Acn){
display();

employeeofthemonthtable();
fscanf( emplyp,"%d%s%s%d%d%d%d%f
%f",&Accnum,firstname,lastname,&daysp,&daysa,&dys_e,&dys_l,&hourswork,&sal
ary);

printf("Press enter to continue.\n");


getch();
fcount=0;
return ;
}
else{
printf("Account was not found.\n");
printf("Press enter to continue.\n");
getch();
fcount=0;
}
fclose(emplyp);
system("cls");
}
}

void sale(){
float sale;
int

option;

int

choice;

float total;
FILE *sales;
if ((sales = fopen("sales.txt","r"))== NULL){
printf("File could not be opened.\n");
printf("Press any key to continue:");
getch();
}
else{
fscanf(sales,"%f",&total);
while(!feof(sales)){
sale += total;
fscanf(sales,"%f",&total);
}

}
system("cls");
display();
printf("\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^\n");
printf("^1:To view total sales made by the cashier for the month. ^\n");
printf("^2:To erase the amount of sales made by the cashier.
printf("^0:To Exit.

^\n");

^\n");

printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^\n");
printf("Choose an option:");
scanf("%d",&option);
switch(option){
case 1:
printf("Total sales made by the Cashier for the month is. $%f\n",sale);
printf("Press any key to continue:");
getch();
system("cls");
break;
case 2:
system("cls");
display();
printf("\t\t\t*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*\n");
printf("\t\t\t^ 1:To delete sales made.
printf("\t\t\t^ 0:To cancel/Exit

^\n");
^\n");

printf("\t\t\t*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*\n");
printf("Are you sure you want to delete all data on sales made?");
scanf("%d",&choice);
switch(choice){
case 1:

if ((sales = fopen("sales.txt","w+"))== NULL){

printf("File could not be opened.\n");


printf("press any key to continue.\n");
getch();

}
else{
printf("Sales amount has been deleted.\n");
printf("Press any key to continue.\n");
getch();
sales=0;

}
break;
case 0:
printf("Sales amount has not been delete.\n");
printf("Press any key to continue.\n");
getch();
break;
default:
printf("You Have Choosen An Incorrect Option.\n");
printf("Press any key to continue:");
getch();
system("cls");
break;
}
case 0:
printf("Exiting. Press any key to continue\n");
getch();
break;

break;

default:

printf("You Have Choosen An Incorrect Option.\n");


printf("Press any key to continue:");
getch();
system("cls");
break;
}
system("cls");
fclose(sales);
}

int main(){
Welcome();
display();
int option;
Mainmenu();
printf("choose an option:");
scanf("%d",&option);
while(option!=0){
switch(option){
case 1:
system("cls");
employeedata();
system("cls");
break;
case 2:
system("cls");
cashier();
system("cls");
break;
case 3:
system("cls");
employeemonth();
system("cls");

break;
case 4:
system("cls");
sale();
system("cls");
break;
case 5:
system("cls");
payrolls();
system("cls");
break;
case 6:
system("cls");
printf("#-------------------------------------#\n");
printf("#Enter 1 to view waiting customers.

#\n");

printf("#Enter 2 if customer is checking out. #\n");


printf("#Enter 0 To exit.

#\n");

printf("#-------------------------------------#\n");
scanf("%d",&option);
if (option==1){
Bill();
getch();
}
if (option==2){
deletee();
getch();
}

system("cls");
break;
default:
printf("You Have Choosen An Incorrect Option.\n");
printf("Press any key to continue:");

getch();
system("cls");
break;
}//switch end
display();
Mainmenu();
printf("choose an option:");
scanf("%d",&option);
}//while end.
printf("Saving data.....\n");
sleep(2000);
printf("Exiting system....\n");
sleep(1000);
return 0;
}//main end.