Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question - 1 Your task is to write a C + + program that demonstrates the use of function templates. The program should find the

Question -1Your task is to write a C++ program that demonstrates the use of function templates. The program should find the maximum value among three input values of different types (int, double, and char) using a function template. Instructions:1. Create a new C++ source file (main.cpp) for your program.2. Create a header file named maximum.h where you will define the function template maximum.3. In the main.cpp file: - Include the maximum.h header file using the #include directive. - Implement the main function, which will be the entry point of your program. - Inside the main function: * Prompt the user to input three integer values and find the maximum among them using the maximum function template. * Prompt the user to input three double values and find the maximum among them using the maximum function template. * Prompt the user to input three character values and find the maximum among them using the maximum function template.Display the maximum values found for each type. Example Output:Input three integer values: 5103The maximum integer value is: 10 Input three double values: 3.57.25.8The maximum double value is: 7.2 Input three characters: A C BThe maximum character value is: C Submission:Submit your completed main.cpp file, which includes the implementation of the main function and the #include directive for the maximum.h header file. Also, submit your maximum.h header file, where you define the function template maximum. Question -2In this question , you will practice creating a simple class called GradeBook and using it in a C++ program. Follow the instructions below to complete the assignment: 1. Define the GradeBook Class: Define a class named GradeBook with a member function named displayMessage. The displayMessage function should take a single parameter of type string, representing the course name. Inside the displayMessage function, output a welcome message that includes the provided course name.2. Create an Object and Display the Message: In the main function, declare a variable named nameOfCourse of type string. Create an object of the GradeBook class named myGradeBook. Prompt the user to enter the name of the course. Read the course name entered by the user into the nameOfCourse variable using the getline function. Call the displayMessage function of the myGradeBook object and pass the nameOfCourse variable as an argument. Ensure that the welcome message is displayed correctly with the provided course name.3. Submit Your Code: Write a C++ program that implements the above steps. Save the program file with an appropriate name (e.g., gradebook.cpp). Ensure your code is properly formatted and documented with comments. Submit your code file through the designated submission platform by the due date.Note: Remember to adhere to best practices for coding, such as using meaningful variable names, proper indentation, and clear comments to explain your code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 1 Lncs 8055

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013 Edition

3642402844, 978-3642402845

More Books