Using C++:

 

 

 

Exercise P10.2. Write a recursive function void reverse() that reverses a sentence. For example: Sentence greeting = new Sentence("Hello!"); greeting.reverse(); cout << greeting.get_text()<<endl; prints the string “olleh”. Implement a recursive solution by removing the first character, reversing a sentence consisting of the remaining text, and combining the two.

 

 

 Exercise P8.6.Write a base class Worker and derived classes HourlyWorker and SalariedWorker. Every worker has a name and a salary rate. Write a virtual function compute_pay(int hours) that computes the weekly pay for every worker. An hourly worker gets paid the hourly wage for the actual number of hours worked, if hours is at most 40. If the hourly worker worked more than 40 hours, the excess is paid at time and a half. The salaried worker gets paid the hourly wage for 40 hours, no matter what the actual number of hours is.

 

 

Exercise P9.1.Write a program that asks the user for a profile name and displays the number of characters, words, and lines in that file. Then have the program ask for the name of the next file. When the user enters a file that doesn’t exist (such as the empty string), the program should exit.

 

    • 11 years ago
    Complete A++ Solution
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      answer.zip