What will the following code display?
Q: What the following code does? int * foo = new int [5]; if (!foo) { ...}
A: To find what the given code does - int *foo = new int[5]; if(!foo) {........}
Q: The value of BX after executing the following piece of code is : *
A: According to the question, we need to find the value of BX after executing the code: XOR AX, AX ADD…
Q: In the following code, what is init_()?
A: Question 11: Ans: a method __init__ is a method of class Critter
Q: What is the output of the following code: int main()
A: static variables share common value local variables have same value
Q: What will the following code display?
A: Given data:- What will the following code display?
Q: What is value of ans after the following code is executed? >> 5 * 5; ; >> ans +
A: ans in matlab is used store the values of the operation. It is a default varible to store the result…
Q: What is the result of evaluating the following postfix expression?
A: Firstly, create a stack to store operands or values Scan the expression and do the following- if…
Q: What happens if you add 4 to ptr, assuming it is a reference to an int?
A: Given: The Addition of an Integer to the Solution Pointers make it possible for two arithmetic…
Q: please write a code for that
A: Since the programming language is not mentioned, I have coded above question Python. Follow the…
Q: Q: what is the left side of the following expression: x@y1?
A: XOR ⊕ returns 0 for the same input and 1 for different inputs. Given, x ⊕ y ⊕ 1
Q: in this code, what does 2 mean and what does it do?
A: Answer: This Matlab program finds the accel values. First we want to declare 2d array for y. e.g. y…
Q: What is the value of num3 after the following code is executed: int num1; int num2; int num3; num1 =…
A: value of num1 is 15.
Q: What is printed by the above code?
A: #include<iostream> using namespace std; void processing(int, double &, char &); int…
Q: Program which accepts the user's first and last name and print them in reverse order with a space…
A: The Answer is
Q: What will the following code display?numbers = [1, 2, 3, 4, 5]print(numbers[-2])
A: Code: numbers = [1, 2, 3, 4, 5]print(numbers[-2])
Q: What is the value assigned to x after the following C expression is executed? int a=1, b=5, x; x=…
A: Please find the answer below
Q: What values will be printed after the following statements execute?
A: Initially, apples=15 bananas=4 pears=10 oranges=18 strawberries=20
Q: Consider the following statement: int* p, q; This statement could lead to what type of…
A: The problem is based on the basics of pointers in programming languages.
Q: How many syntax errors in the following code? Assume all libraries are including
A: question 4 There are four syntax errors in the code. the resolved code class…
Q: What is the output of the following int main()
A: Q
Q: What will the following code display?mystring = 'abcdefg'print(mystring[3:])
A: mystring = 'abcdefg' print(mystring[3:])
Q: What is the value of num3 after the following code is executed: int num1; int num2; int num3; num1 =…
A: // Online Java Compiler// Use this editor to write, compile and run your Java code online class…
Q: What will the following code display?mystring = 'abcdefg'print(mystring[2:5])
A: string_name[a:b] is called string slicing where character from index a to b will be printed.
Q: What is the value of n3 after the following code is executed:
A: The correct answer is: 14 Here is the explanation: Code Result Explanation: int n1 = 2;…
Q: What is the value of val2 after the following code is executed: int val1 = 2; int val2 = val1 * 3;…
A: We need to find the final value of val2.
Q: What will be the output of given code.
A: In the given code a char variable ch is initialised with value 'A'. Then in output &ch is…
Q: What would be the result of the following set of code? int count = 1; while (count <= 10) {…
A: The given Code is 1. int count = 1;2. while (count <= 10)3. {4. cout…
Q: Q1// find the value of x ? # include main () { Int x,y,z ; X=y=z=0
A: Please find the answer below :
Q: What will the following code display?var = '$'print(var.upper())
A: var = '$'print(var.upper()) The output of the above program is as follows:
Q: What will be output by the above code segment ?
A: #include <iostream> using namespace std; int main(void){ int m=1,n=2; //initialize m…
Q: What is y after the following switch statement?
A: I have provided C CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT------------------
Q: What will be the values of the variables a, b and c after executing the following code? int a: int…
A: Answer in step2
Q: What is the output from the following code segment? int point = 1; while ( point ! = 13) { cout <<…
A: In the given code while loop is used. A while loop is an entry controlled loop in which first…
Q: QUESTION 2 Write a program that prints out the following pattern **** **** **** ****
A: Required: C++
Q: What is the output of the following code segment? int x 9; %3D cout << X+3B
A: The output of the given code segment will be 9 Because in the given code increment will be done to…
Q: What will be the values of x and y after the following code is executed? int x = 10, y = 20;…
A: Given, The code in given in C programming language\ Code: int x = 10, y = 20; while (y…
Q: What will be printed after execution of the following code? void main () { int arr[10] =…
A: As we know that according to the initialization of the array elements following values will be…
Q: What will the following code display? mystring = 'abcdefg' print(mystring[:])
A: The variable myString is a string storing value abcdef
Q: Q: what is the left side of the following expression: XOY01?
A: X xor Y xor 1
Q: Find errors in code below- #include int main()
A: Given: A C language code is given which reads an integer variable from user and print that number.…
Q: If you move the pointer too quickly, it seems to disappear, this effect is known as submarining…
A: Given that, If you move the pointer too quickly, it seems to disappear, this effect is known as…
Q: What is the value stored in Y after the above code is executed?. Express your
A: Answer is in given below:-
Q: what is the worst case of the code below
A: Task :- find out the worst case runtime of the given code.
Q: What are the chances that the REpitition code, often known as the Huffman code, will include a…
A: foundation Huffman code, for the most part, is a data compression method. By evaluating the event of…
Step by step
Solved in 2 steps
- please write in C++ using #include <iostream> using namespace std Define a class called DateYear, that represents any year like 2023 in addition to the day and month (03/34/2023). Your class will have one member variable of type int to represent the year. This class is a child of the DayOf Year class where the code is given in lecture14 (Lecture14_Code.cpp). Your DateYear class should have the following member functions: a constructor and a default constructor that sets the year to this year, month to 1 and day to 1. an input function that reads the date (day, month, and year). Make sure to check for inaccurate dates. -getter and setters for the year. an output function that outputs the date in form of xx/xx/xxxx. It can display to the screen or the file. A friend function DateCompare that compares two years and returns true if they are the same. A member function BDCountdown, which calculates and returns how many days till your birthday. This function take the birthday as the…PLEASE HELP: In c++ please The class function needs to be in a header file (.h) The main needs to be on the main .cpp file. Please try to avoid using -> operators. Looking for a solution without them. Any help is very much appreciated. Much thanks! Create a class AccessPoint with the following attributes: x - a double representing the x coordinate y - a double representing the y coordinate range - an integer representing the coverage radius status - On or Off Add constructors. The default constructor should create an access point object at position (0.0, 0.0), coverage radius 0, and Off. Add accessor and mutator functions: getX, getY, getRange, getStatus, setX, setY, setRange and setStatus. Also, add a set function that sets the location coordinates and the range. Add the following member functions: move and coverageArea. Add a function overlap that checks if two access points overlap their coverage and returns true if they overlap. Add a function signalStrength that returns the…Please answer in C++ / Text book question / C++ for scientist and Engineers 3rd edition Construct a class named Fractions containing two integer data members named num and denom, used to store the numerator and denominator of a fraction having the form num/denom. Your class should include a default constructor that initializes num and denom to 1 and four operator functions for adding, subtracting, multiplying, and dividing the two fractions, as follows: Addition: a/b + c/d = (a * d + b * c) / (b * d)Subtraction: a/b - c/d = (a * d - b * c) / (b * d)Multiplication: a/b * c/d = (a* c) / (b * d)Division: (a/b) / (c/d) = (a * d) / (b * c) Finally, your class should have a member function that reduces each fraction to its terms (refer to Exercise 15 in Programming Projects for Chapter 6 for how to do this) as well as input and output functions for entering and displaying a fraction. thanks
- T/F In Java a constructor must always return an int.PROGRAMMING LANGUAGE: C++ Write a complete C++ program with the following features.a. Declare a class Time with two fields, hour and minute.b. Provide appropriate constructors to initialize the data members.c. Overload the pre and postfix increment operators (using memberfunctions) to increment the minutes by one. Also make sure if m inutes are59 and you increment the Time it should update hours and minutesaccordingly.d. Provide a function display() to display the hours and minutes.e. In main(), create objects of Time, initialize them using constructors andcall the display functions.f. Test the following in your main:a. T3= ++T1;b. T4=T2++;FOR C++, PLASE SEND THE ANSER IN 30 MINUTES. ACCORDING TO CODE BELOW, #include "Vehicle.hh" class Ship: public Vehicle { private: int passenger; public: Ship(); Ship(int, float, float); int getPassenger(); void setPassenger(int); void print(); }; (DEFINE FUNCTIONS CORRESPONDING TO SHIP HEADER CLASS IN PART 2 BELOW) #include "Vehicle.hh" #include "Ship.hh" #include <iostream> using namespace std; // *** DEFINE --VEHICLE-- FUNCTIONS FOR PART 1 *** // *** DEFINE --SHIP-- FUNCTIONS FOR PART 2 *** void reduceSpeed(Ship*, float); void takePassenger(Ship*, int); int main() { return 0; } // reduce the speed of ship given in percentage (0 < percentage < 1). void reduceSpeed(Ship *s, float percentage) { // *** FILL THIS FUNCTION FOR PART 3 *** } // takes the number of passengers to the ship void takePassenger(Ship *s, int pas) { // *** FILL THIS FUNCTION FOR PART 4 *** }
- In C++Using the code provided belowDo the Following: Modify the Insert Tool Function to ask the user if they want to expand the tool holder to accommodate additional tools Add the code to the insert tool function to increase the capacity of the toolbox (Dynamic Array) USE THE FOLLOWING CODE and MODIFY IT: #define _SECURE_SCL_DEPRECATE 0 #include <iostream> #include <string> #include <cstdlib> using namespace std; class GChar { public: static const int DEFAULT_CAPACITY = 5; //constructor GChar(string name = "john", int capacity = DEFAULT_CAPACITY); //copy constructor GChar(const GChar& source); //Overload Assignment GChar& operator=(const GChar& source); //Destructor ~GChar(); //Insert a New Tool void insert(const std::string& toolName); private: //data members string name; int capacity; int used; string* toolHolder; }; //constructor GChar::GChar(string n, int cap) { name = n; capacity = cap; used = 0; toolHolder = new…FOR C++, ACCORDING THE VEHICLE HEADER, FILL THE PART 1 OF THE CODE #ifndef _Vehicle_hh_ #define _Vehicle_hh_ class Vehicle { private: float speed; float mile; public: Vehicle(); Vehicle(float, float); float getSpeed(); float getMile(); void setSpeed(float); void setMile(float); void print(); }; #endif (DEFINE FUNCTIONS CORRESPONDING TO VEHICLE HEADER CLASS IN PART 1 BELOW) #include "Vehicle.hh" #include "Ship.hh" #include <iostream> using namespace std; // *** DEFINE --VEHICLE-- FUNCTIONS FOR PART 1 *** // *** DEFINE --SHIP-- FUNCTIONS FOR PART 2 *** void reduceSpeed(Ship*, float); void takePassenger(Ship*, int); int main() { return 0; } // reduce the speed of ship given in percentage (0 < percentage < 1). void reduceSpeed(Ship *s, float percentage) { // *** FILL THIS FUNCTION FOR PART 3 *** } // takes the number of passengers to the ship void takePassenger(Ship *s, int pas) { // *** FILL THIS FUNCTION FOR…Create class Employee that has the following pieces of information called first name, last name, day off and salary. Write a C++ program to implement the following functions for three employees: 1- Constructor to initialize data members. 2- Set and get functions for data members 3- Operate decrement operator to decrement the salary when the employee has a day off. 4- Display the results using friend function called Display().
- Program in C: Part A: Write the code that defines a struct called dog The following information must be kept in appropriate data types: the name of the dog (char array) the breed of the dog (char array) the wieght of the dog (double) Part B: Write a function called GetDogInfo that declares a temporary dog and fills the 3 data fields with user input (remember to prompt for input) return the filled dog (the function return type is dog) Part C: Write a main function with a function call to GetDogInfo- Create a struct called Complex for performing arithmetic with complex numbers. Write a driver program to test your struct. Complex numbers have the form: realPart + imaginaryPart * iwhere i is the square root of -1Use double variables to represent data of the struct. Provide a function that enables an object of this struct to be initialized when it is declared. The function should contain default values in case no initializers are provided. Also provide functions for each of the following:a) Addition of two Complex numbers: The real parts are added together and the imaginary parts are added together.b) Subtraction of two Complex numbers: The real part of the right operand is subtracted from the real part of the left operand and the imaginary part of the right operand is subtracted from the imaginary part of the left operand.c) Printing Complex numbers in the form (a, b) where a is the real part and b is the imaginary partSubmit one file which contains all code above: the structure…In C++ Please: THE PROGRAM CANNOT CONTAIN -> OPERATORS! Create a class AccessPoint with the following: x - a double representing the x coordinate y - a double representing the y coordinate range - an integer representing the coverage radius status - On or Off Add constructors. The default constructor should create an access point object at position (0.0, 0.0), coverage radius 0, and Off. Add accessor and mutator functions: getX, getY, getRange, getStatus, setX, setY, setRange and setStatus. Add a set function that sets the location coordinates and the range. Add the following member functions: move and coverageArea. Add a function overLap that checks if two access points overlap their coverage and returns true if they do. Add a function signalStrength that returns the wireless signal strength as a percentage. The signal strength decreases as one moves away from the access point location. Represent this with bars like, IIIII. Each bar can represent 20% Test your class by writing a…