Create your own Python code examples that demonstrate each of the following. Do not copy examples from the book or any other source. Try to be creative with your examples to demonstrate that you invented them yourself.
The input will be a single line containing two integers and operator(+, -, *, /, and %) similar to 3 + 5.
output
If the given operator is "+", print the sum of two numbers.
If the given operator is "-", print the result of the subtraction of the two numbers.
If the given operator is "*", print the multiplication of the two numbers.
If the given operator is "/", print the result of the division of the two numbers.
If the given operator is "%", print the result of the modulus operation of the two numbers.
Compile time polymorphism using operator overloading
Create a class Distance with feet and inches. Write an overloaded function to copy the value of one distance object into another distance object using = operator overloading.
which is the correct syntax for returning an object by pointer?
a) void functionName ( ){ }
b) object functionName( ) { }
c) class object functionName( ) { }
d) ClassName functionName ( ){ }
How may byte are used in the following main
knowing that int use 4 byte
answer number only, like: 4
class point
{
int x, y;
int main()
{
point obj;
point arr[2];
}
class employee
{
private : int id; char
name [20];
public :
employee(int x=100)
{
id=x;
}
};
Select one:
a. Objects can only be created with
one parameter
b. Objects can be created with zero or
one parameter
c. Objects can be created with many
parameters
d. Objects can only be created with
zero parameter
Create a function with a local variable. Show what happens when you try to use that variable outside the function. Explain the results.
Define a function that takes an argument. Call the function. Identify what code is the argument and what code is the parameter.
Create separate program file for each mode.
:
implement a generic Queue class in java and work with different data types.