Write a Program to demonstrate the following:
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
2. Please do not upload your Assignment on Blackboard in PDF format.
3. Please write the answers, do not attach screenshots / images of answers.
4. For the programs, please write the
6. Please write your own answers from your understanding of the topic.
Answer All the Questions.
1. Write a Program to demonstrate the following:
a) Create a TCP Client Socket object. The name of the object must be your first name along
with last 3 digits of your Student-ID. After creating the client socket object, display the
following message in the output “Your Last Name Created TCP Client Socket”.
b) Attach the client socket object to an IP Address and a port. The IP Address must be in dotted
quad format and the port number must be used for non-standard service.
c) Display the following output.
“Student-ID the IP Address is : xxxxxx”
“Student-ID the Port Number is : zzzzzz”
d) Attach the Output Screen shot.
Note: Please write the program and attach the Output Screenshot. The Student-ID is your nine-digit ID and Your first name is your actual first name. Your Last Name is your actual last name. xxxxxx is the IP Adress of the server to which this client wants to connect and zzzzzz is the port number of the server to which this client wants to connect.
2. Explain in your own words any four methods of Writer Class.
3. Write a Program to demonstrate the following methods. Please attach the Output Screenshot.
a) getLocalHost( ) b) getHostName( ) c) getHostAddress( ) d) getAddress( )
4. Write a program to demonstrate Output Stream Methods. Please consider the following conditions.
a) Declare an output file and name the file as your last name.txt. Using Output Stream method,
display your complete name in the output file. Please note that “your last name” is your
actual last name and “your complete name” is your actual complete name.
b) In the next line, display the last 5 chars of your actual name in the output file, using Output
Stream method.
c) In the next line, display, beginning with the fifth character until the next 5 characters of your
actual name in the output file, using Output Stream method.
d) Attach the screenshot of output file.
5. a) Write a Program to demonstrate Predefined Streams. Attach the Output Screenshot.
b) Why do you need a Socket? Explain in your own words using your own example.
Step by step
Solved in 6 steps