int get_price(int age) // function with return type int and
parameter age
{
if(age <= 12 ){ // Checking condition
return 2; // if the condition satisfies then will return 2
}
if(12 < age && age < 65 ){ //Checking condition
return 5; // if the condition satisfies then will
return 5
}
if( age >= 65 ){ //Checking condition
return 3; // if the condition satisfies then will return 5
}
}
While calling the function have to pass the parameter value.
eg: get_price(25);
Complete program screenshot is given below

C++ C++ C++ C++ 6. (15 points) Finish two subproblems. (1) (12 points) Define a function...
could you solve this in C++ please
2. (25 marks) Define a class called "House", that represents the information of a house. A House is defined with these attributes: age (int), type (string) (Detached, Semi-Attached, Attached), rooms (int) and cost (double). Functions of the House class must perform the following operations: • Return the house age • Modify the house age • Return the house type • Return the number of rooms • A function called estimate Price() that returns...
please explain step by step
2. We all know from Euclidean geometry that two points define a unique linear function. By simple antidifferentiation principles, one needs three noncollinear points to define a unique quadratic function, and by induction, one needs + Ipoints to define a unique nh degree polynomial function. Suppose that you are given (1, 2), (-1, 6), and (2, 3). Using matrix methods for solving systems of equations, find the unique quadratic function that passes through these given...
please answer 1-5
Section 4. Write the following programs. (34 points) 1. (7 points) Define a class called MyLinkedQueue containing two data field: head and tail. Create constructors, setters and getters as appropriate. 2. (7 points) Define an inner class called Queue Node inside MyLinkedQueue containing necessary data fields, and constructors, to make sure the queue can move back and forth. 3. (10 points) Implement the poll and offer methods for the MyLinkedQueue class. 4. (5 points) Implement the isPalindrome...
Implement the algorithm maxArray, discussed in Section 2.4.3, as
a C++ function.
Make sure the following requirements are met.
Program must compile and run.
maxArray function must be a recursive template function.
Add a main function to test the maxArray function so that you
have a complete program.
Test the maxArray function on two arrays of different
types.
Name the program maxarray.cpp. Make sure the following
requirements are met.
2.4.3 Finding the Largest Value in a Sorted or Unsorted Array...
Question 1) Sophia’s friends have invited her to see a movie the following weekend. The movie ticket costs $15. Alternatively, during the time she would be at the movies, she could choose between one of the following two options: i. Work at a café and earn $40. ii. Go to a concert. The ticket to the concert is $20, and she values this experience at $50, Based on the above information, what is Sophia’s opportunity cost of going to the...
In C please
Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). Original maino: int main(void) { double milesPerHour, double minutes Traveled; double hours Traveled; double miles Traveled; scanf("%f", &milesPerHour); scanf("%lf", &minutes Traveled); hours Traveled = minutes Traveled / 60.0; miles Traveled = hours Traveled * milesPerHour; printf("Miles: %1f\n", miles Traveled); return 0; 1 #include <stdio.h> 3/* Your solution goes here */ 1 test passed 4 All tests passed...
Linear Algebra
Matlab exercise: 1. (20 points total) Let -6 28 211 A=14-15-12 L-8 32 25 Write a script that (a) (5 points) Computes and prints on the screen the eigenvalues of A (b) (10 points) Without using eig command, computes and prints on the screen bases for the eigenspaces corresponding to each of the distinct eigenvalues of A (c) (5 points) Plots p(t) (e) (5 points) Plots det(A tI), the characteristic polynomial of A, as a function of t...
1. Write a function to add two integers and return the summation. (Each box is 5 points.) a. Prototype a function: b. In main function; i. Take two integers from user: ii. Define 2 variables and call the function into main function to take the sum: Print the summation: C. Define the function to return the sum:
QUESTION 1 G E. H. C A Finish Start D. Complete the network activity diagram using the table below to answer questions 1-15. The expected activity completion times are provided in days. Each question is 1 point. Most Probable Activity Optimistic Pessimistic A 7 B 12 C 5 12 7 E 10 15 20 6 9 18 G 6 13 H 11 What is the early start (ES) time for activity F? 13 12 10 None of the above are...
5) Define a function called remainder _is_even which receives two positive integer numbers as parameters: num and div. This function should return a boolean value. The value to be returned should be True if the remainder of dividing num by div is even and it should return False otherwise. As an example, the following code fragment: print (remainder_is_even(23,2)) should produce the output: False 6) Define a function first_last_repeated which receives as input parameter a string (orig) with at least one...