Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ programming Write a program which: 1. Prompts the user to enter 5 integers 2. Validates each user entry to ensure that it is an

c++ programming

Write a program which:

1. Prompts the user to enter 5 integers

2. Validates each user entry to ensure that it is an integer

3. Stores the user entries in a one-dimensional array of type int

4. Displays the largest and smallest integer in the array (assume all integers in the array are unique and distinct).

Requirements:

The program must consist of a class called Integers. The class must have:

1. A public function/method called setUserEntry. This function/method is used to:

Prompt the user for an integer

Invoke a method called validate which verifies that the entry is in fact an integer, if the entry is not an integer, the user is NOT allowed to proceed until he/she enters an integer.

2. A public function/method called validate ; which verifies that the entry is in fact an integer, if the entry is not an integer, the user is NOT allowed to proceed until he/she enters an integer.

3. The constructor uses a loop to initialize the elements in the array to zero

4. The displayIntegers function/method is a const public function/function which takes no parameters and uses a loop to display the values of the array.

5. The getLargestSmallestIntegers is a public function/method which displays the largest and the smallest integers in the array.

6. The array is of type int, size 5 and is a private member.

7. The main function must use a loop to keep the user in the program until he/she wants to quit.

8. You MUST submit The following THREE files:

A separate .h file called Integers.h.txt

A separate .cpp file called IntegersImp.cpp.txt

A separate .cpp file with main() called main.cpp.txt

GENERAL RESTRICTIONS

1. No global variables

2. No labels or go-to statements

3. No infinite loops, examples include:

for(;;)

while(1)

while(true)

do{//code}while(1);

4. No break statements to exit loops

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions