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)
- Briefly (1-2 lines) explain the purpose of the function foo.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_forward1) Define a struct to represent a product item with the fields: name, ID, price. 2) Define at least two named instances, e.g., “Jeans” 1223 50 and “Top” 1234 30. 3) Apply selector function to return the ID and price of a product item. 4) It is the January sales. Write a function that takes as argument a struct and updates the price field by giving a 30% discount to the original price. For example, given the struct “Jeans” 1223 50 as argument, the function will update the price field to 35, due to the 30% discount. Make sure to explain what the difference between mutable and immutable is, as comments in your Racket file. 5) Please make sure to submit your code as a Racket file and make sure to add an explanation of how it works as comments.arrow_forward
- Ex. 8.4) The following functions are all intended to check whether a string contains any lowercase letters, but at least some of them are wrong. For each function, describe what the function actually does (assuming that the parameter is a string).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_forwardt) 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_forward
- this one too please Can data members be passed to a function using the object? If yes, explain.arrow_forwardQ2 Write the pseudo-code of Q1 using C++ language supposing that you have the following variables and functions already defined: A1: the distance from target A2: the angle to target MOVEFORWARD: to move forward TURN(VAL): to turn right or left. If the parameter is positive it turns to the right, else to the left.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
- How we can pass the function pointer as a parameter give example.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_forwardWhen 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_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning