Docsity

Program 8: Maximum and Minimum - Computer Science | CSI 1430, Lab Reports of Computer Science

Toggle sidebar
bg1
CSI 1430 Program 8: Max and Min Intro I
Due Nov 4, 23:59:59
Create a class that will find the maximum and the minimum from a list of integers.
The external interface of the class will have the following public functions.
1. Default constructor
Initialize any internal variables.
2. Default destructor
Does nothing (unless you need it to do something)
3. void Reset(void)
Puts the object back into its initial state before any calls to Add, Max, or Min.
This function is used to start over with a new list.
4. void Add(int x)
Adds a number to the list
5. int Max(void)
Returns the maximum of the numbers supplied through the Add function.
6. int Min(void)
Returns the minimum of the numbers supplied through the Add function.
7. bool isInitialized(void);
Returns FALSE right after “Reset” has been called or if “Add” has never been
called. This function indicates that no maximum or minimum value is available.
Everything except these functions must be private. The internal implementation of the
class is up to you, and you may call it anything you wish. The class must work for lists of
unlimited size.
The main function of your program must use your class to determine the maximum
integer in a file of integers. Your program must open a file called “IntList.txt” and must
read until end of file. Once end of file has been reached, your program must close the file
and print the maximum and minimum values found in the following format
Maximum: 300
Minimum: -37
Make sure that one blank line follows the line containing the minimum value.
IMPORTANT REMINDER: Discussing your program with ANYONE other than the
course instructor or the lab assistant is strictly prohibited. The penalty for collusion,
giving unauthorized assistance or receiving unauthorized assistance on any programming
assignment, lab assignment, examination, practicum, or homework exercise is an F for
the entire course.

Partial preview of the text

Download Program 8: Maximum and Minimum - Computer Science | CSI 1430 and more Lab Reports Computer Science in PDF only on Docsity!

CSI 1430 Program 8: Max and Min Intro I

Due Nov 4, 23:59:

Create a class that will find the maximum and the minimum from a list of integers. The external interface of the class will have the following public functions.

  1. Default constructor Initialize any internal variables.
  2. Default destructor Does nothing (unless you need it to do something)
  3. void Reset(void) Puts the object back into its initial state before any calls to Add, Max, or Min. This function is used to start over with a new list.
  4. void Add(int x) Adds a number to the list
  5. int Max(void) Returns the maximum of the numbers supplied through the Add function.
  6. int Min(void) Returns the minimum of the numbers supplied through the Add function.
  7. bool isInitialized(void); Returns FALSE right after “Reset” has been called or if “Add” has never been called. This function indicates that no maximum or minimum value is available.

Everything except these functions must be private. The internal implementation of the class is up to you, and you may call it anything you wish. The class must work for lists of unlimited size.

The main function of your program must use your class to determine the maximum integer in a file of integers. Your program must open a file called “IntList.txt” and must read until end of file. Once end of file has been reached, your program must close the file and print the maximum and minimum values found in the following format Maximum: 300 Minimum: -

Make sure that one blank line follows the line containing the minimum value.

IMPORTANT REMINDER: Discussing your program with ANYONE other than the course instructor or the lab assistant is strictly prohibited. The penalty for collusion, giving unauthorized assistance or receiving unauthorized assistance on any programming assignment, lab assignment, examination, practicum, or homework exercise is an F for the entire course.