Question: Programming language oops using c++ / Please provide the comments briefly and output aswell Functional Requirement: Design a Ocean class to hold data about oceans.

Programming language oops using c++ / Please provide the comments briefly and output aswell

Functional Requirement: Design a Ocean class to hold data about oceans. Create a menu-driven program that will allow the user to enter ocean information and display the data.

Programming Requirements:

1. Design an Ocean class that has the following members:

name: string<= 20 chars and not empty

surfaceArea: (Square Kilometers), float > 0

pollutionArea: (Square Kilometers), float >0

salinityLlevel: ( %), float > 0

Appropriate constructors

Accessors

Mutators (which should have an exit_failure if they are sent invalid data)

A print function that displays the oceans name, volume and pollution area.

Create overloaded operators for + , -, >, <. Use the surface area attribute to do the arithmetic or comparisons.

-------------------------------

Demonstrate the classes by offering a menu of choices to the user:

In main, create an array of ocean objects of SIZE = 5. Offer the user a menu as follows:

1. Enter data for one ocean

2. Search for an ocean and display major attributes

3. Compare 2 objects

4. Do arithmetic on 2 objects

5. Display all oceans in the array

6. Exit

Loop the menu until the user enters (6)

When the user chooses (1) check if there is room in the array. If yes, prompt for, enter and store the data for one ocean.

When the user enters (2) search by name for an ocean. If it is in the array then use the virtual print function to display the major attributes.

When the user enters (3) or (4) prompt for two oceans and the desired operator. Display the result.

When the user enters (5), display all the data in a professional way.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!