1a) Write the start of the class declaration for a node in a linked list (give the name of the class and the instance variables). The name of the node should be SpecialNode. The data in each SpecialNode will include both a String and a Song object.
b)Using the SpecialNode class you created in question above, write a constructor forSpecialNode that has three parameters and initializes all the SpecialNode instance variables.
c) Write a line of code to instantiate a SpecialNode object to initialize the SpecialNodeinstance variables. Use the constructor you wrote in the previous question.
Song rockstar = new Song("Rockstar", 5);
SpecialNode sn = ___________________________________ ;
In: Computer Science
I am using NetBeans IDE Java for coding. I would like the code to be commented for a better understanding.
1. Implement a class Robot that simulates a robot wandering on an infinite plane. The robot is located at a point with integer coordinates and faces north, east, south, or west.
Supply methods:
public void turnLeft()
public void turnRight()
public void move()
public Point getLocation()
public String getDirection()
The turnLeft and turnRight methods change the direction but not the location. The move method moves the robot by one unit in the direction it is facing. The getDirection method returns a string "N", "E", "S", or "W".
In: Computer Science
1. Provide an explanation of the network detection
methods in the chapter, give an example of their importance and
discuss the issue(s) associated with each method.
In: Computer Science
Operating systems typically split functionality into layers. Explain the advantages and disadvantages of the structure of software as layers in distributed systems.
In: Computer Science
Q2) Using the program in Figure 2, identify the values of pid at
lines A, B, C, and D. (Assume that the actual pids of the parent
and child are 2600 and 2603, respectively.) Give a brief
explanation.
#include <sys/types.h> #include <sys/wait.h> #include
<stdio.h> #include <unistd.h>
int main() { pid_t pid, pid1; /*fork a child process*/
pid = fork(); if (pid < 0) { /* error occurred*/ fprintf(stderr,
"Fork Failed"); return 1; } else if (pid == 0) { /*child process*/
pid1 = getpid(); printf("child: pid = %d", pid); /* A */
printf("child: pid1 = %d", pid1); /* B */ } else { /*parent
process*/ pid1 = getpid(); printf("parent: pid = %d", pid); /* C */
printf("parent: pid1 = %d", pid1); /* D */ wait(NULL); }
return 0; }
Figure 2 - What are the pid values displayed?
In: Computer Science
Question 1
In: Computer Science
In: Computer Science
On Android Studio, create a 4 function calculator. The only buttons you need are 0-9, *, /, +, -, a clear, and enter button. Having this java code, I need the XML code that organizes the layout of the calculator.
JAVA CODE -
package com.example.10012698.calculatorproject;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class MainActivity extends AppCompatActivity implements
View.OnClickListener {
Button button0, button1, button2, button3, button4, button5,
button6,
button7, button8, button9, buttonadd, buttonsubtract,
buttonmultiply,
buttondivide, buttonequals, buttonclear;
TextView display;
String displaytext="";
double result;
double x, y;
ArrayList<String> list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button0 = (Button) findViewById(R.id.button0);
button1 = (Button) findViewById(R.id.button1);
button2 = (Button) findViewById(R.id.button2);
button3 = (Button) findViewById(R.id.button3);
button4 = (Button) findViewById(R.id.button4);
button5 = (Button) findViewById(R.id.button5);
button6 = (Button) findViewById(R.id.button6);
button7 = (Button) findViewById(R.id.button7);
button8 = (Button) findViewById(R.id.button8);
button9 = (Button) findViewById(R.id.button9);
buttonadd = (Button) findViewById(R.id.buttonadd);
buttonsubtract = (Button) findViewById(R.id.buttonsubtract);
buttonmultiply = (Button) findViewById(R.id.buttonmultiply);
buttondivide = (Button) findViewById(R.id.buttondivide);
buttonclear = (Button) findViewById(R.id.buttonclear);
buttonequals = (Button) findViewById(R.id.buttonequals);
display = (TextView) findViewById(R.id.display);
display.setOnClickListener(this);
list = new ArrayList<>();
}
public void onClick(View view)
{
if(!(view.equals(buttonclear)&&!(view.equals(buttonequals))))
{
display.setText(display.getText()+""+((Button)view).getText());
if(displaytext.equals("0"))
{
display.setText(" ");
}
if(view.equals(buttonclear))
{
display.setText(" ");
}
if(view.equals(buttonequals))
{
displaytext= displaytext.substring(0,displaytext.length()-1);
StringTokenizer operators= new StringTokenizer(displaytext,
"+-*/",true);
while(operators.hasMoreTokens())
{
list.add(operators.nextToken());
}
for(int j=0; j<list.size()-1; j++)
{
if (list.get(j).equals("*") || list.get(j).equals("/"))
{
x = Double.parseDouble(list.get(j - 1));
y = Double.parseDouble(list.get(j + 1));
if (list.get(j).equals("*"))
{
result+=(x*y);
}
if (list.get(j).equals("/"))
{
result+=(x/y);
}
}
}
for(int k=0;k<list.size()-1;k++)
{
if (list.get(k).equals("+") || list.get(k).equals("-"))
{
x = Double.parseDouble(list.get(k - 1));
y = Double.parseDouble(list.get(k + 1));
if (list.get(k).equals("+"))
{
result+=(x+y);
}
if (list.get(k).equals("-"))
{
result+=(x-y);
}
}
}
}
display.setText(""+result);
}
}
In: Computer Science
Python Loop invariant
To show that an assertion A is a loop invariant , is it enough to argue that the execuation of the loopbody preserves A? Please desscribe it throughly.
In: Computer Science
Write C++ programs to implement Queue ADT data structure using Linked List.
In: Computer Science
Try to make it as simple as you can. Please provide the answers with some examples as fast as you can.
1-Which of the following best defines a computer used as a server?
a)Computer hardware that includes fast disk drives and a lot of memory
b)Operating system software that includes clients, such as a Web browser and Client for Microsoft Networks
c)Operating system software that includes directory services and domain name services
d)A computer with Linux installed.
2-If you want to make a computer a domain controller, which of the following should you installed?
|
a)Client for Microsoft Networks |
b)File and Printer Sharing for Microsoft Networks |
c)Domain Name Services |
d)Active Directory |
3-You have been asked to advise a business on how best to set up its Windows network. Eight workstations are running Windows Vista Business. The business recently acquires a new contract that requires running a network application on a server. A secure and reliable environment is critical to run this application, and security management should be centralized. There is enough budgets for new hardware and software, if necessary. Which Windows networking model should you advise this business to use?
a)A Windows domain using Active Directory b)A Window workgroup using Active Directory
c)A peer –to-peer network using File and Printer Sharing d)A peer-to-peer network using Active Directory
4-What command should you use to test your IP configuration settings after a new Windows Server 2012 installation?
|
a)Dir |
b)Arp |
c)Ping |
d)Hostname |
5-Which of the following is a reason for installing a new server? (Choose all that apply.)
|
a)Excessive load on existing servers |
b)Fault tolerance |
c)Adding a new network protocol |
d)To isolate a new application |
6-Which of the following is a feature of Active Directory? (Choose all that apply.)
|
a) Fine-grained access controls |
b) Can be distributed among many servers |
c) Can have only one server |
d) Has a fixed schema |
7-Which of the following is the responsibility of domain controllers? (Choose all that apply.)
|
a) Storing a copy of the domain data |
b) Providing data search and retrieval functions |
c) Servicing multiple domains |
d) Providing authentication services |
8-Which of the following is associated with an Active Directory forest? (Choose all that apply.)
a)Contains trees with different naming structures b)Allows independent domain administration
c)Contains domains with different schemas d)Represents the broadest element in Active Directory
9-Which of the following defines the types of objects in Active Directory?
|
a) GOPs |
b) Attribute values |
c) Schema attributes |
d) Schema classes |
10-Which container has a default GPO linked to it?
|
a)Users |
b)Printers |
c)Computers |
d)Domain |
In: Computer Science
int count = 10;
while (count >= 0)
{
cout << count << endl;
count = count + 3;
}
How many times will this loop be executed?
Endless loop
3 times
0 times
Once
In: Computer Science
Try to make it as simple as you can. Please provide the answers with some examples as fast as you can.
1-Which of the following best defines a computer used as a server?
a)Computer hardware that includes fast disk drives and a lot of memory
b)Operating system software that includes clients, such as a Web browser and Client for Microsoft Networks
c)Operating system software that includes directory services and domain name services
d)A computer with Linux installed.
2-If you want to make a computer a domain controller, which of the following should you installed?
|
a)Client for Microsoft Networks |
b)File and Printer Sharing for Microsoft Networks |
c)Domain Name Services |
d)Active Directory |
3-You have been asked to advise a business on how best to set up its Windows network. Eight workstations are running Windows Vista Business. The business recently acquires a new contract that requires running a network application on a server. A secure and reliable environment is critical to run this application, and security management should be centralized. There is enough budgets for new hardware and software, if necessary. Which Windows networking model should you advise this business to use?
a)A Windows domain using Active Directory b)A Window workgroup using Active Directory
c)A peer –to-peer network using File and Printer Sharing d)A peer-to-peer network using Active Directory
4-What command should you use to test your IP configuration settings after a new Windows Server 2012 installation?
|
a)Dir |
b)Arp |
c)Ping |
d)Hostname |
5-Which of the following is a reason for installing a new server? (Choose all that apply.)
|
a)Excessive load on existing servers |
b)Fault tolerance |
c)Adding a new network protocol |
d)To isolate a new application |
6-Which of the following is a feature of Active Directory? (Choose all that apply.)
|
a) Fine-grained access controls |
b) Can be distributed among many servers |
c) Can have only one server |
d) Has a fixed schema |
7-Which of the following is the responsibility of domain controllers? (Choose all that apply.)
|
a) Storing a copy of the domain data |
b) Providing data search and retrieval functions |
c) Servicing multiple domains |
d) Providing authentication services |
8-Which of the following is associated with an Active Directory forest? (Choose all that apply.)
a)Contains trees with different naming structures b)Allows independent domain administration
c)Contains domains with different schemas d)Represents the broadest element in Active Directory
9-Which of the following defines the types of objects in Active Directory?
|
a) GOPs |
b) Attribute values |
c) Schema attributes |
d) Schema classes |
10-Which container has a default GPO linked to it?
|
a)Users |
b)Printers |
c)Computers |
d)Domain |
In: Computer Science
What is true about Random Access Files? Check all that apply.
|
1. The program can read file data anywhere the read location is positioned. |
||
|
2. Data must be sorted to to use random access functions. |
||
|
3. Data can be read in any order specified in the program. |
||
|
4. seekp and seekg can be used to access files by a given position. |
In: Computer Science
How to make a python program that imports only turtle and math library where I can click once on the screen to set the center of the square, move the mouse to define the edge-length of the square; click a second time to draw the square with the defined edge-length and center point?
In: Computer Science