Create a program with 3 functions:

(i) main()
(ii) calculateCval()
(iii) calculatePval()

ex. calculateCval should have:

double calculateCval(double S, double K)

calculateCval will calculate max(0, S - K) (A)
calculatePval will calculate max(0, K S) (B)

main:

(i) Ask user to input S, K using (cin) and print out calculateCval and calculatePval using the equations A and B.

(ii) Run a loop where S ranges from 70 to 120 in increments of 1 and print out the same as in step (i) for K = 100

(iii) Run a loop where K ranges from 70 to 120 in increments of 1 and print out the same as in step (i) for S = 111

(iv) Use 'if' statement for conditional execution:

(a) Ask a user to enter 0 or 1
(b) Is user enters 0, then ask user to enter a S value and calculate value using equation B with K = 100
(c) If user enters 1, then ask user for a K value and print out value using equation A for S = 60
(d) If user enters something else print 'error'.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.