how can I save a character stack to a string and then save that string into a new string arraylist in java?
so if the character stack is h, e, l, l, o
i want it to save "hello" to a string and then put that string into
an array list.
In: Computer Science
Current U.S. military doctrine recognizes four categories of power available to a nation: diplomatic, informational, military, and economic. Upon examination, it is apparent that only a nation/state can wield these elements of power; they would be beyond the reach of weaker powers or organizations. How then, can these lesser entities influence the powerful? Five “underdog” strategies are outlined as alternative sources of power for the weak. If you are trying to influence the national policy of the United States, which of these five strategies do you feel would be the most effective? Why?
In: Computer Science
Using the Web, find a case of cyber stalking that is not
mentioned in this chapter. You may find some of the following
websites helpful:
www.safetyed.org/help/stalking/
Write a brief paper discussing this case, with particular attention
to steps you think might have helped avoid or ameliorate the
situation.
In: Computer Science
Linux Question: you will practice on creating and editing a text file by VI.
How to:
$ sudo yum –y install java-1.8.0-openjdk-devel.x86_64
Here's the code
import java.util.Scanner; // Import the Scanner class class MollyHomework { public static void main(String[] args) { Scanner myObj = new Scanner(System.in); // Create a Scanner object System.out.println("Enter your first name"); String fName = myObj.nextLine(); // Read user input of the first name System.out.println("Enter your last name"); String lName = myObj.nextLine(); // Read user input of the last name System.out.println("Hello " + fName + “ “ + lName); // Output user input } } |
3.To compile the above java code, run the following command (you need to use your java file name):
$ javac MollyHomework.java
4. To execute the java program, run the following command
$ java MollyHomework
Question:
Describe how you created above file and its contents in VI.
Note: Brute-force solution means that entering characters one by one.
*Show how the code looks or how you got it to work in your linux machine
In: Computer Science
1.
In which VoIP phase does Skype use a server instead of service directly between peers?
signaling |
||
transport |
||
login |
||
None of these |
2.
Skype login is necessary so that the user ________.
can find the IP address of a Skype proxy server |
||
can find the IP address of a client it wishes to communicate with |
||
can find her own Skype address |
||
None of these |
3.
Why is link-by-link encryption for confidentiality not fully secure even if there is encryption for confidentiality in all links along the way?
There cannot be confidentiality on each link. |
||
Devices along the way may not be secure. |
||
both There cannot be confidentiality on each link and Devices along the way may not be secure |
||
neither There cannot be confidentiality on each link nor Devices along the way may not be secure |
4.
Which of the following is a file format standard?
HTML |
||
HTTP |
||
both HTML and HTTP |
||
neither HTML nor HTTP |
5.
When a cloud client customer moves from one client machine to another, ________.
the same data files are available |
||
the same application software personalization is in effect |
||
both the same data files are available and the same application software personalization is in effect |
||
neither the same data files are available nor the same application software personalization is in effect |
6.
In Skype, a directory search to find the IP address of a client to be called, is done by ________.
peers |
||
super nodes |
||
Skype servers |
||
direct communication between the calling and receiving clients |
7.
Skype provides ________.
Voice over IP |
||
Video over IP |
||
both Voice over IP and Video over IP |
||
neither Voice over IP nor Video over IP |
8.
Which of the following allows you to read your e-mail easily on an Internet café's computer?
HTTP |
||
HTML |
||
IMAP |
||
SMTP |
In: Computer Science
Write a C++ program that will be an information system for Oregon State University using classes as well as demonstrating a basic understanding of inheritance and polymorphism.
You will create a representation of an Oregon State University information system that will contain information about the university. The university will contain a name of the university, n number of buildings, and m number of people. People can be either a student or an instructor. Every person will have a name and an age. Every student will have also have a GPA, but an instructor will NOT have a GPA. Every instructor will have an instructor rating, but a student will NOT have an instructor rating. Every building will have a name, the size in sqft (preferred the real value which you need to look up), and an address (stored as a string, also preferred to look this up).
People will contain a method called “do_work” that will take in a random integer as a parameter that represents how many hours they will do work for. If the person is a student, a message will be printed to the screen that says “PERSON_NAME did X hours of homework.” If the person is an instructor, a message will be printed to the screen that says “Instructor PERSON_NAME graded papers for X hours.” You will need to fill in the appropriate values.
The student GPA can either be an input from the user or randomized, but it must be between 0.0 and 4.0. It cannot be preset. The instructor rating can either be an input from the user or randomized, but it must be between 0.0 and 5.0. The ages of a person can be randomized or an input, but make it realistic. You can choose whether it is randomized or user input, or both.
The university will contain a method that will print the name and address of all the buildings in its information system and another method that will print the name of all the people. The name of the university MUST be “Oregon State University” (because we are the best).
You will manually instantiate at least 1 student, 1 instructor, and 2 buildings, then give them values and store them appropriately in the university object. You can do this in whatever fashion you wish.
You will have a menu that does at least the following:
1) Prints names of all the buildings
2) Prints names of everybody at the university
3) Choose a person to do work
4) Exit the program
Note that option 3 will require you to print another menu that gives options for each person.
You may create any other functions, methods, member variables, etc. to modularize your code and complete the lab.
Extra Credit Add an option to save the information system to a file, and add an option to read a saved information system from a file so that you can close the program, but not lose information. This will also require you to be able to add people and/or buildings to the program during runtime. This is an all or nothing extra credit (you will not get partial points for partial completion).
In: Computer Science
Class GroceryBag
collects instances of class Item in an appropriate
data structure.
Class Item
---------------------------
-String description
-int cost //price in cents
----------------------------
+ [constructor, getters, and a toString() method]
• (Assume
class Item has already been coded)
Class GroceryBag (Highlights)
----------------------------------
-bag // an ArrayList of
<Item>
----------------------------------
assume public methods: constructor, totalBag(), findItem(String
it), listAll(), etc.
• The
ONLY thing you need to do in the space below is to
write java code for the complete method specified:
• In
the space below, write code for a complete method
void showCheapItems()
that will use the ArrayList
bag and which will display all
Items in the bag whose price is below the overall average
of
all the prices of all the items in the bag.
[Hint: average will be the sum divided by the number of
items].
Required: use at least one for-each loop as part of your
method.
please help quickly!!!!!
In: Computer Science
Research and include the following:
In: Computer Science
Consider the following Java program. Describe what it does in response to specific operations of the mouse, and how it does it. (You are encouraged to run the program for yourself to test its behavior. Then read through the program carefully to understand how that behavior arises.)
import java.awt.event.*;
import javax.swing.*;
public class MouseWhisperer extends JFrame implements MouseListener
{
MouseWhisperer() {
super("COME
CLOSER");
setSize(300,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addMouseListener(this);
setVisible(true);
}
public void mouseClicked(MouseEvent e) {
setTitle("OUCH"); }
public void mousePressed(MouseEvent e) {
setTitle("LET GO"); }
public void mouseReleased(MouseEvent e) {
setTitle("WHEW"); }
public void mouseEntered(MouseEvent e) {
setTitle("I SEE YOU"); }
public void mouseExited(MouseEvent e) {
setTitle("COME CLOSER"); }
public static void main(String[] args) { new
MouseWhisperer(); }
}
In: Computer Science
Implement the Metropolis-Hastings algorithm below¶
Make sure to read this: Implement the algorithm described above (in the "How it works" section), where you take some user-defined number of steps that randomly step in W and I and are scaled by a step_size. This means you don't want to take steps of a discrete size, but instead use a random distribution of step sizes that are scaled by your step_size variable. You'll want to take steps that have an equal chance of either decrementing or incrementing the values of W and I. Also, W and I don't have to incremented by the exact same amount, in fact, it would best if they weren't so that you can explore more of the parameter space.
Keep track of your accepted guesses for width and intercepts in the lists that are provided below. We have included variables with reasonable values of these quantities to get you started.
# Total number of points we're going to sample (start out with
at least 10^4)
num_sample_points = 100000
# Weight factor in front of the random step
step_size = 0.1
# As we move the walker around, we'll use these same lists
to
# store our new values so that we can visualize the path later!
# (Note: that means you'll want to append new values to these lists!)
widths = [2]
intercepts = [2]
## PUT YOUR CODE HERE ###
In: Computer Science
in c++ codeblocks
Convert the following code into a switch structure. Make the switch structure as short as possible (do not repeat code). if (i == 3 || i == 5) { n++; tryagain = 0; } else if (i == 4) || i == 10) { n = 5; } else if (i == 6) { n = 6; } else { n = 0; tryagain = 1; }
Write an if statement that will give 5 extra credit points to students who answer Question A correctly, and 10 extra points if they answer Question A and Question B correctly. Name the variable intBonus.
In: Computer Science
comparision of 8T SRAM and 6T SRAM cells with simulation graphs ?
In: Computer Science
In: Computer Science
Answer the question:
Some IT security personnel believe that their organizations should
employ former computer criminals to identify weaknesses in their
organizations’ security defenses. Do you agree? Why or why not?
Notes:
answer by using your own words, please.
the name of the course is "Professional Computing Issues."
In: Computer Science
Suppose you have the following two data sequences: 1101110101100110, and 0101010101010010. What is the value you should put in the checksum field if those are the only data you have?
In: Computer Science