Input device your welcome
Answer:
Explanation:
The following code was written in Java. The code contains the Employee class which contains the two variables (name, salary), the constructor, getter and setter methods for both variables, and an overwritten toString method. It also contains a tester class with the main method inside and creates a Employee object and initializes it. Then it calls the toString method. The output can be seen in the attached image below. Due to technical difficulties I have added the code as a txt file below.
Answer:
my explanation is above my comment :)
Explanation:
Answer:
Following is the program in C++ Language
#include <iostream> // header file
using namespace std; // namespace std
int main() // main method
{
int n; // variable declaration
cout<<" Please enter the number :";
cin>>n; // Read the number
if(n>0) // check the condition when number is positive
{
cout<<n<<endl<<"The number is Positive"; // Display number
}
else if(n<0) // check the condition when number is Negative
{
cout<<n<<endl<<"The number is Negative";// Display number
}
else // check the condition when number is Zero
{
cout<<n<<endl<<"The number is Zero";// Display number
}
return 0;
}
Output:
Please enter the number:
64
The number is Positive
Explanation:
Following are the description of the program
- Declared a variable "n" of int type.
- Read the value of "n" by user.
- Check the condition of positive number by using if block statement .If n>0 it print the number is positive.
- Check the condition of negative number by using else if block statement If n<0 it print the number is negative.
- Finally if both the above condition is fail it print the message " The number is Zero"