What is the output of the following
int manip(int);
int manip(int, int);
int manip(int, double);
int main()
{
int x = 2, y= 4, z;
double a = 3.1;
z = manip(x) + manip(x, y) + manip(y, a);
cout << z << endl;
return 0;
}
int manip(int val)
{
return val + val * 2;
}
int manip(int vail, int val2)
{
return (vail + val2) * 2;
}
int manip(int vail, double val2)
{
return vail * static_cast<int>(val2);
}
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Starting Out With C++: Early Objects (10th Edition)
Additional Engineering Textbook Solutions
Concepts of Programming Languages (11th Edition)
Artificial Intelligence: A Modern Approach
Digital Fundamentals (11th Edition)
Java How To Program (Early Objects)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- class Test { char paper[20]; int marks; public: Test () // Function 1 { strcpy (paper, "Computer"); marks = 0; } Test (char p[]) // Function 2 { strcpy(paper, p); marks = 0; } Test (int m) // Function 3 { strcpy(paper,"Computer"); marks = m; } Test (char p[], int m) // Function 4 { strcpy (paper, p); marks = m; } }; i. Write statements in C++ that would execute Function 1, Function 2, Function 3 and Function 4 of class Test. ii. Which feature of Object Oriented Programming is demonstrated using Function 1, Function 2, Function 3 and Function 4 together in the above class Test?arrow_forward#include using namespace std; class fraction{ float d,s; public: fraction() { d=0; s=1; fraction(int a, int b) { d=%3; s=b3; } void print() { cout<arrow_forwardPROBLEM STATEMENT: An anagram is a word that has been rearranged from another word, check tosee if the second word is a rearrangement of the first word. public class AnagramComputation{public static boolean solution(String word1, String word2){// ↓↓↓↓ your code goes here ↓↓↓↓return true;}} Can you help me with this java question the language is java please use the code I gavearrow_forwardC programming please complete (a),(b),(c)arrow_forwardvoid main (void) { char result = a; for (char i = { 10; i > 5; i = i-1) result = result + i; } // point B } Consider the code above. What is the decimal value of "result" at "point B" if the variable "a" is initially 59?arrow_forwardFor the C++ program show on the next page, answer the questions that follow. The names g, j, x, and y are declared multiple times. Distinguish uses of these names using line numbers where they were declared as subscripts. a. At point A in the program, what names are in scope? b. At point A in the program, what variables are live? c. At point B in the program, what names are in scope? d. At point B in the program, what variables are live?arrow_forwardPlz write the algorithm for thisarrow_forward3).class jump_statments { public static void main(String args[1) { int x = 2; int y = 0; for (; y < 10; ++y) { if (y % x 0) == continu e; else if (y 8) break; == else %3D System.out.print(y + " "); } a) 1357 b) 24 68 c) 1 3579 d) 1234 5 6 7 8 9arrow_forwardmport java.util.Scanner; public class ParkingCharges { // function to calculate the basic charge using the asked hours static double getBasicCharge(int hours) { if (hours >= 7 && hours <= 8) return 5.50; else if (hours >= 5 && hours <= 6) return 4.50; else if (hours >= 2 && hours <= 4) return 4.00; return 3.00; } // function to return the amount to subtract based on local living and OAP static double getDiscount(String isLocal, String isOAP) { if (isOAP.equals("Yes") && isLocal.equals("Yes")) return 2.0 + 1.0; else if (isOAP.equals("Yes")) return 2.0; else if (isLocal.equals("Yes")) return 1.0; return 0; } public static void main(String[] args) { // create a new Scanner object Scanner sc = new Scanner(System.in); // prompt the user to ask if they are disabled…arrow_forward// SuperMarket.java - This program creates a report that lists weekly hours worked // by employees of a supermarket. The report lists total hours for // each day of one week. // Input: Interactive // Output: Report. import java.util.Scanner; public class SuperMarket { public static void main(String args[]) { // Declare variables. final String HEAD1 = "WEEKLY HOURS WORKED"; final String DAY_FOOTER = " Day Total "; // Leading spaces are intentional. final String SENTINEL = "done"; // Named constant for sentinel value. double hoursWorked = 0; // Current record hours. String hoursWorkedString = ""; // String version of hours String dayOfWeek; // Current record day of week. double hoursTotal = 0; // Hours total for a day. String prevDay = ""; // Previous day of week. boolean done = false; // loop control Scanner input = new…arrow_forwardQuestion public class MyProgram { if (h 18) { public static void main(String[] args) { int h=10, t-22; System.out.print ("Good "); } } else } } What is the output displayed by the following lines of code?" System.out.print ("Morning"); t = t + 2; if (t > 30) System.out.println(" Every one!"); System.out.println("The Your answer system.out.print("Evening"); t = t + 5; temperature is " System.out.println(" Brink water?"); Degree.");arrow_forwardUrgent Answer Pleasearrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education