Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Maslee Mart is a convenience store company operating in the state of Johor. The company has five stores located in several branches; Johor Bahru,
The Maslee Mart is a convenience store company operating in the state of Johor. The company
has five stores located in several branches; Johor Bahru, Segamat, Batu Pahat, Kota Tinggi and
Mersing, respectively. At the end of each year, the management of the company wants to know
the performance of their company. They have decided to use a computer program to help them
in analyzing the companys sales. You, as a freelance programmer have been appointed to
develop the program using C language. The requirements of the program are as follow:
Input:
o The program should read in sales data from a text file named salesdat as shown
in Figure
o The format of the input file is as follows: The first to twelfth columns indicate the sales
for each month, ie the first column is for the sales of January, second column is for
February, third column is for March, and so forth. The last column indicates store
branches. Note that sales in each cell is represented in multiple of RM
Output:
o The program should print out a report into an output file as shown in Figure
o The report should include:
o The grand total of sales, ie over all stores throughout the year.
o The average sales per month.
o The highest sales. Print the store, month and the sales whose the highest sales.
o The lowest sales. Print the store, month and the sales whose the lowest sales.
o The total sales for each month. The months should be printed with their
abbreviated names, such asJanFebMar and so forth.
o The total sales for each store.
o The list of profitable stores. A store is considered profitable if it manages to
achieve minimum annual sales of RM
Note that all money values have to be specified as with decimal points, spaces in
width, and rightjustified.
Use array onedimension orand twodimension to store the input data from file and
the output data.
The program should be written in several userdefined functions for example readFile
to read data from file, grandTotalSales to calculate the total of sales over all store
throughout the year, highestSale to find the highest sale, lowestSale to find the
lowest sales, etc. Each function must be implemented with the concept of parameter
passing. Use appropriate arguments for each function. Do not use global variables.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started