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
In C Programming, Thanks
Many user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "q*s" to the end of the input string. You may assume that the string does not contain spaces and will always contain less than 50 characters.
Ex: If the input is:
mypassword
the output is:
[email protected]*s
In: Computer Science
You will be building a linked list. Make sure to keep track of both the head and tail nodes. (1) Create three files to submit. PlaylistNode.h - Struct definition and related function declarations PlaylistNode.c - Related function definitions main.c - main() function Build the PlaylistNode class per the following specifications. Note: Some functions can initially be function stubs (empty functions), to be completed in later steps. Private data members char uniqueID[50] char songName[50] char artistName[50] int songLength PlaylistNode* nextNodePtr Related functions CreatePlaylistNode() (1 pt) InsertPlaylistNodeAfter() (1 pt) Insert a new node after node SetNextPlaylistNode() (1 pt) Set a new node to come after node GetNextPlaylistNode() Return location pointed by nextNodePtr PrintPlaylistNode() Ex. of PrintPlaylistNode output: Unique ID: S123 Song Name: Peg Artist Name: Steely Dan Song Length (in seconds): 237 (2) In main(), prompt the user for the title of the playlist. (1 pt) Ex: Enter playlist's title: JAMZ (3) Implement the PrintMenu() function. PrintMenu() takes the playlist title as a parameter and outputs a menu of options to manipulate the playlist. Each option is represented by a single character. Build and output the menu within the function. If an invalid character is entered, continue to prompt for a valid choice. Hint: Implement Quit before implementing other options. Call PrintMenu() in the main() function. Continue to execute the menu until the user enters q to Quit. (3 pts) Ex: JAMZ PLAYLIST MENU a - Add song r - Remove song c - Change position of song s - Output songs by specific artist t - Output total time of playlist (in seconds) o - Output full playlist q - Quit Choose an option: (4) Implement "Output full playlist" menu option. If the list is empty, output: Playlist is empty (3 pts) Ex: JAMZ - OUTPUT FULL PLAYLIST 1. Unique ID: SD123 Song Name: Peg Artist Name: Steely Dan Song Length (in seconds): 237 2. Unique ID: JJ234 Song Name: All For You Artist Name: Janet Jackson Song Length (in seconds): 391 3. Unique ID: J345 Song Name: Canned Heat Artist Name: Jamiroquai Song Length (in seconds): 330 4. Unique ID: JJ456 Song Name: Black Eagle Artist Name: Janet Jackson Song Length (in seconds): 197 5. Unique ID: SD567 Song Name: I Got The News Artist Name: Steely Dan Song Length (in seconds): 306 (5) Implement the "Add song" menu item. New additions are added to the end of the list. (2 pts) Ex: ADD SONG Enter song's unique ID: SD123 Enter song's name: Peg Enter artist's name: Steely Dan Enter song's length (in seconds): 237 (6) Implement the "Remove song" function. Prompt the user for the unique ID of the song to be removed.(4 pts) Ex: REMOVE SONG Enter song's unique ID: JJ234 "All For You" removed (7) Implement the "Change position of song" menu option. Prompt the user for the current position of the song and the desired new position. Valid new positions are 1 - n (the number of nodes). If the user enters a new position that is less than 1, move the node to the position 1 (the head). If the user enters a new position greater than n, move the node to position n (the tail). 6 cases will be tested: Moving the head node (1 pt) Moving the tail node (1 pt) Moving a node to the head (1 pt) Moving a node to the tail (1 pt) Moving a node up the list (1 pt) Moving a node down the list (1 pt) Ex: CHANGE POSITION OF SONG Enter song's current position: 3 Enter new position for song: 2 "Canned Heat" moved to position 2 (8) Implement the "Output songs by specific artist" menu option. Prompt the user for the artist's name, and output the node's information, starting with the node's current position. (2 pt) Ex: OUTPUT SONGS BY SPECIFIC ARTIST Enter artist's name: Janet Jackson 2. Unique ID: JJ234 Song Name: All For You Artist Name: Janet Jackson Song Length (in seconds): 391 4. Unique ID: JJ456 Song Name: Black Eagle Artist Name: Janet Jackson Song Length (in seconds): 197 (9) Implement the "Output total time of playlist" menu option. Output the sum of the time of the playlist's songs (in seconds). (2 pts) Ex: OUTPUT TOTAL TIME OF PLAYLIST (IN SECONDS) Total time: 1461 seconds
In: Computer Science
please show the differences in the kmeans clustering algorithms using graphs:
hartigan wong method, macqueen method, and lloyd floyd method
In: Computer Science
You're installing VirtualBox on a Windows 10 Home computer and
you get the following error message:
VT-x is disabled in the BIOS for all CPU modes
What is the problem? How do you fix it?
In: Computer Science
Try to make it as simple as you can. Please provide the answers with some examples as fast as you can.
11-Which of the following do all domains in the same forest have in common? (Choose all that apply.)
a) The same domain name |
b) The same schema |
c) The same user accounts |
d) The same global catalog |
12-Which of the following is a valid reason for using multiple forests?
a) Centralized management |
b) Need for different schemas |
c) Easy access to all domain resources |
d) Need for a single global catalog |
13-Which of the following is a reason for establishing multiple sites? (Choose all that apply)
a) Improving authentication efficiency |
b) Enabling more frequent replication |
c) Reducing traffic con the WAN |
d) Having only one IP subnet |
14-Which of the following are valid reasons why administrators might want to install their Windows Server 2012 servers using the Server Core option? (Choose all that apply)
a.A Server Core installation can be converted to the full GUI without reinstalling the operating system.
b.The PowerShell 3.0 interface in Windows Server 2012 includes more than 10 times as many cmdlets as PowerShell 2.0
c.The new Server Manager in Windows Server 2012 make it far easier to administer servers remotely
d.A Windows Server 2012 Server Core license costs significantly less than a full GUI license.
15-Windows Server 2012 requires what processor architecture?
a) 64-bit processor only |
b) 32-bit processor and 64-bit processor |
c) Any processor provided it is physical, not virtual |
d) Minimum dual-core processor |
16-Which features must you remove from a full GUI installation of Windows Server 2012 to convert it to a Server Core Installation? (Choose all that apply)
a. |
Windows Management Instrumentation |
b. |
Graphical Management Tools and Infrastructure |
c. |
Desktop Experience |
d. |
Server Graphical Shell |
17-What client applications utilize Domain Name System (DNS) to resolve host names into IP addresses?
a. |
Client web browser, or any application that uses HyperText Transfer Protocol (HTTP) use DNS to resolve host names into IP addresses |
b. |
All Internet applications working with host names must use DNS to resolve host name into IP addresses |
c. |
Any application on a system that has connectivity to the Internet use DNS to resolve host names into IP addresses |
d. |
DNS does not resolve host names into IP addresses. |
18-Which of the following does an Active Directory client use to locate objects in another domain?
|
|
|
|
19-What the default trust relationship between domains in one forest?
a. |
Two-way trust relationship between domain trees |
b. |
By default, no trust relationship between domain trees |
c. |
One-way trust relationship between domain trees |
d. |
Each domain tree trusts the forest, but not between each other |
20-You are planning an Active Directory implementation for a company that currently has sales, accounting, and marketing departments. All department heads want to manage their own users and resources in Active Directory. What features will permit you to set up Active Directory to allow each manager to manage his or her own container but not any other container?
a. |
Delegation of control |
b. |
Read-only domain controller |
c. |
Multimaster replication |
d. |
SRV records |
In: Computer Science
Try to make it as simple as you can. Please provide the answers with some examples as fast as you can.
11-Which of the following do all domains in the same forest have in common? (Choose all that apply.)
a) The same domain name |
b) The same schema |
c) The same user accounts |
d) The same global catalog |
12-Which of the following is a valid reason for using multiple forests?
a) Centralized management |
b) Need for different schemas |
c) Easy access to all domain resources |
d) Need for a single global catalog |
13-Which of the following is a reason for establishing multiple sites? (Choose all that apply)
a) Improving authentication efficiency |
b) Enabling more frequent replication |
c) Reducing traffic con the WAN |
d) Having only one IP subnet |
14-Which of the following are valid reasons why administrators might want to install their Windows Server 2012 servers using the Server Core option? (Choose all that apply)
a.A Server Core installation can be converted to the full GUI without reinstalling the operating system.
b.The PowerShell 3.0 interface in Windows Server 2012 includes more than 10 times as many cmdlets as PowerShell 2.0
c.The new Server Manager in Windows Server 2012 make it far easier to administer servers remotely
d.A Windows Server 2012 Server Core license costs significantly less than a full GUI license.
15-Windows Server 2012 requires what processor architecture?
a) 64-bit processor only |
b) 32-bit processor and 64-bit processor |
c) Any processor provided it is physical, not virtual |
d) Minimum dual-core processor |
16-Which features must you remove from a full GUI installation of Windows Server 2012 to convert it to a Server Core Installation? (Choose all that apply)
a. |
Windows Management Instrumentation |
b. |
Graphical Management Tools and Infrastructure |
c. |
Desktop Experience |
d. |
Server Graphical Shell |
17-What client applications utilize Domain Name System (DNS) to resolve host names into IP addresses?
a. |
Client web browser, or any application that uses HyperText Transfer Protocol (HTTP) use DNS to resolve host names into IP addresses |
b. |
All Internet applications working with host names must use DNS to resolve host name into IP addresses |
c. |
Any application on a system that has connectivity to the Internet use DNS to resolve host names into IP addresses |
d. |
DNS does not resolve host names into IP addresses. |
18-Which of the following does an Active Directory client use to locate objects in another domain?
|
|
|
|
19-What the default trust relationship between domains in one forest?
a. |
Two-way trust relationship between domain trees |
b. |
By default, no trust relationship between domain trees |
c. |
One-way trust relationship between domain trees |
d. |
Each domain tree trusts the forest, but not between each other |
20-You are planning an Active Directory implementation for a company that currently has sales, accounting, and marketing departments. All department heads want to manage their own users and resources in Active Directory. What features will permit you to set up Active Directory to allow each manager to manage his or her own container but not any other container?
a. |
Delegation of control |
b. |
Read-only domain controller |
c. |
Multimaster replication |
d. |
SRV records |
In: Computer Science