1. Engineering
  2. Computer Science
  3. write a program consisting of two files calculationsh calculatorcpp the...

Question: write a program consisting of two files calculationsh calculatorcpp the...

Question details

Write a program consisting of two files:

       calculations.h

       calculator.cpp

The file calculations.h contains the instructions to do six different things:

a) Add two numbers together

b) Subtract one number from another

c) Multiply two numbers together

d) Divide one number by another

e) Square a number

f) Find the average of a set of numbers between 1 and 5 (use default arguments)

The file calculator.cpp will provide a menu for a user such that the following sample output is produced, with the underlined characters the result of user input:

This program is a multi-function calculator.

Select your operation from the list below (and type q to quit):

1) Addition 2) Subtraction

3) Multiplication 4) Division

5) Squaring 6) Averaging

Operation: 2

Enter the first number: 5

Enter the second number: 3

Result: 2

Select your operation from the list below (and type q to quit):

1) Addition 2) Subtraction

3) Multiplication 4) Division

5) Squaring 6) Averaging

Operation: 5

Enter the number: 4

Result: 16

Select your operation from the list below (and type q to quit):

1) Addition 2) Subtraction

3) Multiplication 4) Division

5) Squaring 6) Averaging

Operation: 6

Enter the size of your data set: 3

Enter number 1: 5

Enter number 2: 5

Enter number 3: 5

Result: 5

Select your operation from the list below (and type q to quit):

1) Addition 2) Subtraction

3) Multiplication 4) Division

5) Squaring 6) Averaging

Operation: q

Press any key to return to Quincy…

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution