Computer Science, asked by 18kmr00751, 7 months ago

Programming Problem (50 Marks):
Given below is a generic List ADT. From this ADT, write three implementations in C++, one using a
stack, one using a priority queue, and one using a linked list.
bool isEmpty(FloatList list) – returns true if the list is empty, otherwise false.
FloatList constructList(float newElement, FloatList oldList) – constructs a new list with copies of all of
the elements from oldList and newElement
Precondition: oldList is a list with 0 or more elements
Postcondition: the list returned by constructList contains newElement
float firstElement(floatList list) – returns the first element in the list, but does not remove it
Precondition: isEmpty(list) == false
Postcondition: none
FloatList restOfList(FloatList oldList) – returns a copy of list that contains every element except
firstElement(oldList)
Precondition: oldList is a list with 1 or more elements
Postcondition: newList = restOfList(oldList)
newList contains every element in oldList except the first element
Note: This is an abstract definition of the operations that the List ADT should perform. It is your job to
create classes for this ADT which implement at least these features.
What the program does
We are interested in generating forecasts of sales data based on the three calculations below. Your task
is to write a program called forecast that will take as its arguments the name of a data file and the name
of a product. From these arguments, the program will extract the data needed to perform calculations for
the specified product. You must use the generic ADT List defined above. For the data file, use the
comma-delimited file.
The output of the program, if the product is listed in the data file, should be exactly as below (truncate

values to integers for the output, but not during the calculations, as this would decrease the accuracy of
the results):
Product: Wheel
Simple average: 2491
Slope: 2019
Linear regression: 2148
If the product is not found in the file, the output should be exactly as below:
Product productName not found in fileName
Where productName is the name of the product and fileName is the name of the input file. For
example,
if the product Wheel is not found in the file Forecast, the output should be exactly as below:
Product Wheel not found in Forecast

Answers

Answered by ayeshasiddiqa687
1

Answer:

The accuracy will increase . simple product :2491 which has the input file

Similar questions