Its 10, value always has to be positive.
Answer: Port
Explanation :
When we port a software from one computer to another computer or from one operating system to another operating system, it tries to adapt to the new environment of the machine by checking the required the configurations of the machine and then checking the available files in the software to run the machine.
The porting of a software also checks whether the software is compatible with the machine or not and if not then why.
Answer:
if(y==10)
{
x=0; // assigning 0 to x if y equals 10.
}
else
{
x=1; // assigning 1 to x otherwise.
}
Explanation:
In the if statement i have used equal operator == which returns true if value to it's right is equal to value to it's left otherwise false.By using this operator checking value of y and if it is 10 assigning 0 to x and if it is false assigning 1 to x.
Answer:
def validateCreditCard(x):
if type(x)==str and len(x) == 8:
print("Valid credit card number")
else:
print("Invalid credit card number")
validateCreditCard("43589795")
Explanation:
Run the code on your text editor(vs code, sublime, pycharm ) you will get your desired response. If your input is not of type string and not up to 8 digit you will get the response "invalid credit card number" but if it is of type string and up to 8 digit you will get "Valid credit card number".
But remember python works with indentation so when you are transferring this code to your text editor it will run properly well.
I defined the code using the conventional pattern "def"
After defining the function you create a brackets (x) to accommodate your argument x and end it with a semi colon.
Then i use "if" statement to make sure only string argument and 8 digit value will be accepted to print a "valid credit card". if your argument does not pass the if statement condition it will print out the else statement condition which is "Invalid credit card number"
Finally, you have to call your function and test various values.
Answer:
C++.
Explanation:
#include <iostream>
#include <string>
using namespace std;
////////////////////////////////////////////////////////////
class Television {
string brand;
float screen_size;
bool powerOn;
int volume;
int channel;
public:
// Comments
Television(string brand, int screen_size) {
this->brand = brand;
this->screen_size = screen_size;
powerOn = false;
volume = 20;
channel = 2;
}
//////////////////////////////////////////
// Comments
int getVolume() {
return volume;
}
// Comments
int getChannel() {
return channel;
}
// Comments
string getManufacturer() {
return brand;
}
// Comments
float getScreenSize() {
screen_size;
}
///////////////////////////////////////////
// Comments
void setChannel(int channel) {
this->channel = channel;
}
// Comments
void power() {
if (!powerOn)
powerOn = !powerOn;
}
// Comments
void increaseVolume() {
volume = volume + 1;
}
// Comments
void decreseVolume() {
volume = volume - 1;
}
};