Solution :
public class NewMain {
public_static void main_(String[] args) {
boolean[] _locker = new boolean_[101];
// to set all the locks to a false NOTE: first locker is the number 0. Last locker is the 99.
for (int_i=1;i<locker_length; i++)
{
locker[i] = false;
}
// first student opens all lockers.
for (int i=1;i<locker.length; i++) {
locker[i] = true;
}
for(int S=2; S<locker.length; S++)
{
for(int k=S; k<locker.length; k=k+S)
{
if(locker[k]==false) locker[k] = true;
else locker[k] = false;
}
}
for(int S=1; S<locker.length; S++)
{
if (locker[S] == true) {
System.out.println("Locker " + S + " Open");
}
/* else {
System.out.println("Locker " + S + " Close");
} */
}
}
}
Answer:
The definition of a class Telephone is given as
public class Telephone // class telephone
{
String number; // variable number of type string
static int quantity = 250;
// variable quantity of type int
static double total = 1565.92; // variable total of type double
}
Explanation:
Following is the description of Statement
- Create a class "Telephone" by using the keyword class.In that class we declared data member .
- We declared a variable "number" of type "string" which has no constructor.
- We declared a variable "quantity" of type "int" which is a static type variable. The static type variable retains the value during the program execution.
- We declared a variable "total" of type "double" which is a static type variable. The static type variable retain the value during the program execution .
The below code will help you to solve the given problem and you can execute and cross verify with sample input and output.
#include<stdio.h>
#include<string.h>
int* uniqueValue(int input1,int input2[])
{
int left, current;
static int arr[4] = {0};
int i = 0;
for(i=0;i<input1;i++)
{
current = input2[i];
left = 0;
if(current > 0)
left = arr[(current-1)];
if(left == 0 && arr[current] == 0)
{
arr[current] = input1-current;
}
else
{
for(int j=(i+1);j<input1;j++)
{
if(arr[j] == 0)
{
left = arr[(j-1)];
arr[j] = left - 1;
}
}
}
}
return arr;
}
The programmer solves the problems of a user by expressing an algorithm in a programming language to make a program that can run on a computer.
The TCP/IP stack is responsible for the "chopping up" into packets of the data for transmission and for their acknowledgment. Depending on the transport protocol that is used (TCP or UDP) each packet will be <span>acknowledged or not, respectively.
</span><span>the strategy when the file is chopped up into packets, which are individually acknowledged by the receiver, but the file transfer as a whole is not acknowledged is OK in situations (Applications) that do not need the whole file to be sent, Web site for example: different parts of the web site can arrive in different times.
The other strategy, in which </span><span>the packets are not acknowledged individually, but the entire file is acknowledged when it arrives is suitable for FTP (mail transfer), we need whole mail, not parts of it. </span>