Program plan:
1 .courseName and instructorNamevariables are used for inputs
2.GradeBook() constructor gets the name of course and its instructor
3. void setCourseName() stores the value of course name to class variable
4. string getCourseName() returns the course name
5. void setInstructorName() stores the value of instructor to class variable
6. void getInstructorName() returns the instructor name
7. void displaymessage() provides the information about course and its instructor
Program description:
The main purpose of the program is to allow user to store the course name and instructor name using constructor. It allows to update the course name and instructor name using setter and getter functions. Finally, it displays the course and instructor name information.
Want to see the full answer?
Check out a sample textbook solutionChapter 16 Solutions
C How to Program (8th Edition)
- C++ programming Language Write a program that converts a number entered in Roman numerals todecimal form. Program should consist of a class, say romanType. Anobject of romanType should do the following:a. Store the number as a Roman numeral.b. Convert and store the number into decimal form.c. Print the number as a Roman numeral or decimal number as requested by the user. (Write two separate functions—one to print the number as aRoman numeral and the other to print the number as a decimal number.)The decimal values of the Roman numerals are:M 1000D 500C 100L 50X 10V 5I 1Remember, a larger numeral preceding a smaller numeral means addition,so LX is 60. A smaller numeral preceding a larger numeral means subtraction, so XL is 40. Any place in a decimal number, such as the 1s place, the10s place, and so on, requires from zero to four Roman numerals. (The program must include implementation files, .cpp and .h )arrow_forward13. What is the difference between a formal parameter and an argument? Group of answer choices A function’s argument is referred to as the formal argument to distinguish it from the value that is passed in during the function call. The parameter is the passed value. They are identical but using different terms. A function’s parameter is used for passing by reference. The argument is used for passing by value. A function’s parameter is referred to as the formal parameter to distinguish it from the value that is passed in during the function call. The argument is the passed value. A function’s parameter is used for passing by value. The argument is used for passing by reference.arrow_forwardQ2) (Perfect Numbers) An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number because 6 = 1 + 2 + 3. Write a function perfect that determines if parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect. Challenge the power of your computer by testing numbers much larger than 1000.arrow_forward
- t) Write a one-liner JAVA function that takes a string s and an integer i as the parameters and removes the character at index i from the string s and returns the string. public static String deleteCharAt_i(String s, int i){ //write your one-line code here }arrow_forwardinteger) Write a function that computes the sum of the digits in an integer. Use the following function header:def sumDigits(n):For example, sumDigits(234) returns 9 (Hint: Use the % operator to extract digits, and the // operator to remove the extracted digit. For instance, toextract 4 from 234, use 234 % 10 To remove 4 from 234, use 234 // 10 (=23) Use a loop to repeatedly extract and remove the digits until all the digits are extracted.) Write a test program that prompts the user to enter an integer and displays the sum of all its digits.arrow_forwardTODO Create the function add func to complete the following TODO (). Create the add func() function, which accepts two arguments. The function should use the + operator to add the two arguments and then return the result. For instance, 3 should be returned if the arguments' input values are 1 and 2. Likewise, "good day" should be returned if the input arguments are "good" and "day." # TODO 6.1 print(f"add_func output for 1 + 2: {add_func(1, 2)}") print(f"add_func output for good + day: {add_func('good',' day')}") todo_check([ (add_func(1,2) == 3,'add_func() did not return 3 when using input values 1 and 2.'), (add_func('good',' day') == "good day",'add_func() did not return "good day" when using input values "good" and " day"') ])arrow_forward
- When an object is passed to a function, a copy of it is made if the object is A) passed by valueB) passed by referenceC) passed by constant referenceD) any of the abovearrow_forwardModify the below code according to what is asking you to do. Show your modified code in a picture, please.arrow_forward1. A function that make use of reference parameters to share its output to the caller. The function has one of the parameter of type int , whose value is a 3 digit number, it must separate its digit And calculate the cube of each of its digit separately as output and share these cubes with its caller. Ø 2. A function that has no parameter but a char array initialized by some name. If the name starts and end at the same letter then function should return true, else return false. Ø 3. Write a main function to call the above two functions. NOTE: Program written in c++arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning