The protections from the security software must continue when the device is taken off the network, such as when it is off-grid, or in airplane mode and similar. Still, much of the time, software writers can expect the device to be online and connected, not only to a local network but to the World Wide Web, as well. Web traffic, as we have seen, has its own peculiar set of security challenges. What are the challenges for an always connected, but highly personalized device?
In: Computer Science
Browse Apple apps at the iTunes App Store. Search under medical apps and attempt to organize them into categories in a table. Are there categories that are missing, e.g. clinical guidelines for patients? Any future predictions about new categories of software? Pick one of your categories and describe the types of Apps in it.
In: Computer Science
Given the below Java code snippet, assuming the code is correct, and the names are meaningful, select the best answer for the below questions:
public static void main(String[] args) {
int numStations = 10;
int enter = 0;
int exit = 0;
Train train = new Train(numStations);
for (int station = 0; station < numStations; station++)
{
enter = enter + train.enterPassengers(station);
exit = exit + train.exitPassengers(station);
}
System.out.println("Number of passengers entered the train: " + enter);
System.out.println("Number of passengers exited the train: " + exit);
System.out.println("Number of passengers remaining on the train: " + (enter-exit));
}
The for-loop in the code is:
Counting the number of stations in the train
Is looping 9 times to determine enter and exit of the train
Sums up the number of passengers entering and leaving the train
Exercise #2
Review the below Java method and assume the comments are correct.
// determines if positive number is odd or even
// returns true if even
public Boolean isEven(int num)
{
if (num <= 0)
{
return false;
}
if (num%2 = 0)
return true;
return false;
}
Select the best answer what is wrong with the code:
It is setting variable to uninitialized value
It is using undeclared variable
It is using single equal sign as equality
Exercise #3
Review the below Java method and assume the comments are correct.
// Initialize array values to 0
public void initialize()
{
int[] values = new int[10];
for (int i = 1; i <= 10; i++)
values[i] = 0;
}
Select the best answer what is wrong with the code:
It is using an uninitialized array
It is overstepping array boundary
It is looping too many times
None of the above
Exercise #4
Given the below Java code snippet, assuming the code is correct, and the names are meaningful, select the best answer for the below question:
fax.setNumber("8761234567");
fax.load(paper);
String status = fax.run();
System.out.println("The fax result status : " + status);
The code snippet :
Makes multiple paper copies
Starts the fax machine and displays status
Loads paper and sends a fax
In: Computer Science
**** In C++ ****Exercise #3: Design and implement a program (name it ArrayMethods), that defines 4 methods as follows: int arrayMax(int[] arr) returns the maximum value in the an array int arrayMin(int[] arr) returns the minimum value in an array void arraySquared(int[] arr) changes every value in the array to its square (value²) void arrayReverse(int[] arr) reverses the array (for example: array storing 7 8 9 becomes 9 8 7 ) The program main method creates a single-dimensional array of length 5 elements and initialize it with random integers between 1 and 100. The program displays the original array, then calls each of the above methods and displays their results as shown below. Document your code and organized your output following these sample runs. Sample run 1: Original array: 3, 5, 2, 6, 1 Max value: 6 Min value: 1 Squared array: 9, 25, 4, 36, 1 Reversed array: 1, 36, 4, 25, 9 Sample run 2: Original array: 3, 2, 3, 7, 2 Max value: 7 Min value: 2 Squared array: 9, 4, 9, 49, 4 Reversed array: 4, 49, 9, 4, 9 Sample run 3: Original array: 2, 2, 2, 2, 2 Maxvalue: 2 Min value: 2 Squared array: 4, 4, 4, 4, 4 Reversed array: 4, 4, 4, 4, 4
In: Computer Science
The primary objective of this assignment is to reinforce the concepts of string processing.
Part A: Even or Odd
For this first part, write a function that will generate a random number within some range (say, 1 to 50), then prompt the user to answer if the number is even or odd. The user will then input a response and a message will be printed indicated whether it was correct or not. This process should be repeated 5 times, using a new random number for each play, regardless of whether the user was correct or not.
Notes
>>> assign2PartA()
Is 41 odd or even? Odd
Correct
Is 48 odd or even? Even
Correct
Is 3 odd or even? e
Incorrect
Is 20 odd or even? o
Incorrect
Is 42 odd or even? xyz
You did not enter a correct reply.
Please answer using Odd or Even
Part B: Vowel Counting
The second task is to write a function that counts, and prints, the number of occurrences for each vowel (a, e, i, o and u) in a given phrase and outputs a (new) phrase with the vowels removed. The phrase should be accepted as a parameter to the function. If the (original) phrase is empty, you should output an appropriate error message, and obviously with no vowel counts. If the phrase contains no vowels, a message should be displayed, and the count can be omitted – since there is no point in displaying 0 for each vowel! A message should also be displayed if the phrase contains only vowels, but the counts should still be displayed.
Notes
>>> assign2PartB("Remember that context here defines
\"+\" as 'Concatenate'")
A E
I O U
4 10 1
2 0
The original phrase is: Remember that context here defines "+"
as 'Concatenate'
The phrase without vowels is: Rmmbr tht cntxt hr dfns "+" s
'Cnctnt'
>>> assign2PartB("bcdfghjklmnpqrstvwxyz")
The phrase contains no vowels: bcdfghjklmnpqrstvwxyz
>>> assign2PartB("aeiouAEIOU")
A E
I O U
2 2
2 2 2
The phrase contains only vowels: aeiouAEIOU
>>> assign2PartB("")
The input phrase is empty!
>>>
In: Computer Science
Java Class
import java.io.File;
import java.io.FileNotFoundException;
import java.util.InputMismatchException;
import java.util.Scanner;
public class ReadInData {
public static double readData(String fileName)
{
File file = new
File(fileName);
Scanner scan;
double sum = 0;
try {
scan = new
Scanner(file);
int numOfValues
= Integer.parseInt(scan.nextLine()); // Read in Val for #
values
for(int i = 0; i
< numOfValues; i++) { // for-loop to get that many values
sum += scan.nextDouble(); // add the values
together (doubles)
}
scan.close();
return sum; //
return the sum of all the values in the file
}//add catch statements
here
}
public static void main(String[] args) {
System.out.println(readData("Test3.txt"));
System.out.println(readData("Test2.txt"));
System.out.println(readData("Text4.txt")); // notice spelling of
the file name!
System.out.println(readData("Test4.txt"));
}
}
Test2.txt
6 5 3.0 "9.8" -19.8 -54.1 85.5
Test3.txt
4.0 5.0 6.2 4.2 1.0
Test4.txt
5 4.2 3.1 2.2 6.1
In: Computer Science
In: Computer Science
Find the computational complexity i.e. O(n) etc. for the following four loops and explain why you came to that answer:
In: Computer Science
I am writing a scheme function that pairs an element to every element in a list, and I have the following code so far:
(define (pair-element e l)
(cond ((null? l) (list e))
(else (cons e (car l)) (pair-element (cdr l)))))
(pair-element 4 `(4 3 5))
What is my error? I'm getting a pair element mismatch when I run it. I need to do this without using built-in functions. Thanks!
In: Computer Science
For a given CPU, the cycle latency for a set of operations are given as follows:
Addition: 4
Subtraction: 8
Multiplication: 64
Division: 80
If the clock of this CPU runs at 3GHz, find the following
How many operations of each of the list above can this CPU perform in 5 minutes?
If we have a set of operations that contains 10^9 of each operation in the list in part 1, compute the required time in seconds to execute the set. Please explain the formula used.
In: Computer Science
Please make your Task class serializable with a parameterized and copy constructor, then create a TaskListDemo with a main( ) method that creates 3 tasks and writes them to a binary file named "TaskList.dat". We will then add Java code that reads a binary file (of Task objects) into our program and displays each object to the console. More details to be provided in class.
Here is a sample transaction with the user (first time the code is run):
Previously saved Tasks from binary file:
[None, please enter new Tasks]
Please enter task name (or "quit" to exit): Ace CS 112 Final
Exam
Please enter due date (in form MM/DD/YYYY): 10/10/2019
Please enter deadline : 3:20 PM
Please enter priority : 1
After 1 Task has been saved (second time the code is run):
Previously saved Tasks from binary file:
Task [name=Ace CS 112 Midterm Exam, dueDate=10/10/2019,
deadline=3:20 PM, priority=High]
Please enter task name (or "quit" to exit): quit
I don't know how to print the priorities High, medium, and Low in the toString method to where it is stored in the binary file after the user types 1, 2, or 3. 1 for high, 2 for medium, and 3 for low.
import java.io.*; import java.util.Scanner; public class IC10_TaskList { public static void main(String[] args) { String name, dueDate, deadline; int priority; Scanner keyboard = new Scanner(System.in); Task[] allTasks = new Task[10]; int count = 0; File binaryFile = new File("Task.dat"); try { System.out.println("\nPreviously saved tasks from the binary file:"); if (binaryFile.exists()) { ObjectInputStream inFile = new ObjectInputStream(new FileInputStream(binaryFile)); allTasks = (Task[]) inFile.readObject(); inFile.close(); for(int i = 0; i < allTasks.length; i++){ if(allTasks[i] != null){ System.out.println(allTasks[i]); count++; } else break; } } else System.out.println("[None, Please enter new task data]"); } catch(IOException e){ System.err.println("Cannot find Task.dat"); } catch(ClassNotFoundException e){ System.err.println("Serial Task version does not match."); } do{ System.out.print("\nPlease enter task name(or \"quit\" to exit): "); name = keyboard.nextLine(); if(name.equalsIgnoreCase("quit")) break; System.out.print("Please enter due date(in form MM/DD/YYYY): "); dueDate = keyboard.nextLine(); System.out.print("Please enter deadline: "); deadline = keyboard.nextLine(); System.out.print("Please enter priority: "); priority = keyboard.nextInt(); allTasks[count++] = new Task(deadline, dueDate, name, priority); keyboard.nextLine(); } while(!name.equalsIgnoreCase("quit")); try{ ObjectOutputStream outFile = new ObjectOutputStream(new FileOutputStream(binaryFile)); outFile.writeObject(allTasks); outFile.close(); } catch(IOException e){ System.err.println("File Task.dat cannot be found and/or written."); } } }
import java.io.Serializable; import java.util.Objects; public class Task implements Serializable { public static final long serialVersionUID = 1; private String mDeadline; private String mDueDate; private String mName; private int mPriority, mChoice; public Task(String deadline, String dueDate, String name, int priority) { mDeadline = deadline; mDueDate = dueDate; mName = name; mPriority = priority; } public String getDeadline() { return mDeadline; } public void setDeadline(String deadline) { mDeadline = deadline; } public String getDueDate() { return mDueDate; } public void setDueDate(String dueDate) { mDueDate = dueDate; } public String getName() { return mName; } public void setName(String name) { mName = name; } public int getPriority() { return mPriority; } public void setPriority(int priority) { mPriority = priority; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Task task = (Task) o; return mPriority == task.mPriority && mDeadline.equals(task.mDeadline) && mDueDate.equals(task.mDueDate) && mName.equals(task.mName); } @Override public int hashCode() { return Objects.hash(mDeadline, mDueDate, mName, mPriority); } @Override public String toString() { return "Task[" + "Name = " + mName + ", Due Date = " + mDueDate + ", Deadline = " + mDeadline + ", Priority = " + mPriority + "]"; } }
In: Computer Science
You will create a program that will follow the queuing theory of the Barbershop Problem. You will initially create a flow chart for the assignment to be uploaded to the Queuing Theory Flowchart assignment drop box. In this you will use queues and random number generators to complete this project. You will create three queues
You will create a container for the barbers chairs (list) . The wait times for the barbers will be random. Barber one will be the fastest and barber three will be the slowest. Randomize the wait times accordingly.
The cashier wait times will also vary randomly.
Barber wait times.
Cashier wait time
In: Computer Science
How has bribery been changed since it has become a statutory crime?
In: Computer Science
JAVA CODE
Give the definition of a static method called showArray that has an array of base type char as a single parameter and that writes to the screen each character in the array on a separate line. It then writes the same array characters in reverse order. This method returns a character array that holds these two lines of characters in the order that you printed them.
In: Computer Science
3) Please answer full question thoroughly (A- J) showing detailed work. Double check answer and work to ensure it is correct for thumbs up.
Boolean Functions, Truth Tables, Logic Minimization, Two-Level Forms Consider a boolean function f (a, b, c, d). Suppose that the function is 1 if
• There is a single 1 among the inputs, or
• There is a single 0 among the inputs, or
• There are exactly two 1’s among the inputs
and it is 0 otherwise.
(a) Write down a truth table for the function
(b) Using a Karnaugh map, provide a minimal sum-of-products (AND-OR) expres- sion.
(c) Using a Karnaugh map, provide a minimal product-of-sums (OR-AND) expres- sion.
(d) Provide a minimal NAND-NAND expression
(e) Provide a minimal OR-NAND expression (f) Provide a minimal NOR-OR expression
(g) Provide a minimal NOR-NOR expression (h) Provide a minimal AND-NOR expression
(i) Provide a minimal NAND-AND expression
(j) Provide a AND-XOR expression (with no negations)
In: Computer Science