For each of the exercises, you need to write an algorithm and pseudo-code, in a comment section of the source code (.cpp). The algorithm and pseudo-code can cover only the key portion of the solution. There is no need to write algorithms for trivial code. Some examples of algorithms are given at the end of this assignment.

Exercise 1 – Function Overloading

Write an overloaded function Add( ) that takes two parameters of the same type. The possible types of the arguments are type double, int, and char array[ ]. (Hint: define three Add().)

Write a test driver and ask the user if he/she would like to add two doubles, two int, or two character arrays. In the case of adding two char arrays, just output the two arrays one after the other using two cout statements.

Exercise 2 (Ch. 7 - Arrays)

Write a program that will read up to 10 letters (characters) into an array and write the letters back to the screen in the reverse order. The program should prompt the user to input all values and can determine whether the input has ended by a punctuation mark such as ‘.’ (make sure that you’ll include meaningful and intuitive messages to the user).

For example, if the input is abcde, the output should be edcba. Include appropriate messaging (UI) to the user.

Exercise 3 (Multidimensional Arrays)

Write a program that asks a student for his/her grades assessing his/her C++ programming skills. The student gets a separate grade for each homework assignment and the lab exam associated with it. In order for the student to pass the class, he/she needs to achieve 50% or better in all possible “dimensions”, i.e.,

  • >= 50% average in homework assignments
  • >= 50% average in lab exams

Assume that the student has been given 5 “sets” of homework assignments and lab exams, respectively, and that the scores are given in percentages.

The program should get input from the screen and do the following:

  • Calculate the best, worst, and average grade for each of the two components (hw assignments and lab exams).
  • Calculate the overall grade of the student, as the average of the hw/lab sets averages.
  • Decide whether the student passes the class or not. If the student cannot pass the class, the program should output the reason why.
  • Output on the screen the input and results so that they look similar to this (use appropriate tools for formatting I/O):
1 2 3 4 5
************************
HW 100 90 80 100 100 BEST HW: 100 WORST HW: 80 AVG HW: 94
LAB 100 100 70 60 90 BEST LAB: 100 WORST LAB: 90 AVG LAB: 84

AVG 100 95 75 80 95 Overall: 89

(option 1) Congratulations! You passed the class!
(option 2) I’m sorry to inform you that you failed the class, because your performance in was <50%. Try again next semester.
  • (Optional) Output the same information as above to a file. The user should input the file name during run time). Do this part only if you know how to write to a file. Will teach in the class later.
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.