Clearly in an environment of the internet of things and the fog of the internet, traditional firewalls and traditional cyber security methodology is insufficient to protect critical infrastructure and industry from cyber-attacks. In a substantive post (at least 250 words or greater) Develop your model of what a successful cyber defense should be, and substantiate your argument.
In: Computer Science
Assume that you have a linked list of records. Assume that you have a head, a current, and a tail pointer. Write an algorithm that DELETES the node BEFORE the current node. You can use pseudo-code, English or drawing to describe your solution.( this was, and remains to be, a popular technical interview question)
In: Computer Science
using java with proper header and comments:
This exercise will give you a review of Strings and String processing. Create a class called MyString that has one String called word as its attribute and the following methods: Constructor that accepts a String argument and sets the attribute. Method permute that returns a permuted version of word. For this method, exchange random pairs of letters in the String. To get a good permutation, if the length of the String is n, then perform 2n swaps. Use this in an application called Jumble that prompts the user for a word and the required number of jumbled versions and prints the jumbled words. For example, Enter the word: mixed Enter the number of jumbled versions required: 10 xdmei eidmx miexd emdxi idexm demix xdemi ixdme eximd xemdi xdeim Notes: 1. It is tricky to swap two characters in a String. One way to accomplish this is to convert your String into an array of characters, swapping the characters in the array, converting it back to a String and returning it. char[] chars = word.toCharArray(); will convert a String word to a char array chars. String result = new String(chars); converts a char array chars into a String. p 6 2. Use Math.random to generate random numbers. (int)(n*Math.random()) generates a random number between 0 and n-1
In: Computer Science
Fill in the code for the following C functions. Function srl performs a logical right shifting using arithmetic right shift (given by value xsra), followed by other operations not including right shifts or division. Function sra performs an arithmetic right shift using a logical right shift (given by value xsrl), followed by other operations not including right shift or division. you may use the computation 8*size of (int) to determine w, the number of bits in data type int. The shift amount k can change from 0 to w-1.
unsigned srl (unsigned x, int k){
unsigned xsra = (int) x>> k;
.
.
.
}
int sra (int x, int k){
int xsrl = (unsigned) x >> k;
.
.
.
}
In: Computer Science
Please Fix Syntax Error
import java.util.Scanner;
public class SalaryCalc {
double Rpay = 0, Opay = 0;
void calPay(double hours, double rate) {
if (hours <= 40) {
Rpay = hours *
rate;
Opay = 0;
} else {
double Rhr,
Ohr;
Rhr = 40;
Ohr = hours -
Rhr;
Rpay = Rhr *
rate;
Opay = Ohr *
(1.5 * rate);
}
}
public static void main(String[] args) {
Scanner sc = new
Scanner(System.in);
String name;
int shift = 0;
Double rate, hours;
System.out.println("Pay
Calculator");
String ch = "";
//added loop here to take the
inputs repetedly
do {
System.out.println("Enter Your Name");
name =
sc.next();
System.out.println("Enter Your Shift, Enter 0 for Day, Enter1 for
Night");
System.out.println("0=Day, 1= Night");
shift=sc.nextInt();
System.out.println("Enter Number of Hours Worked");
hours =
sc.nextDouble();
System.out.println("Enter Hourly Pay");
rate =
sc.nextDouble();
SalaryCalc c =
new SalaryCalc();
c.calPay(hours,
rate);
Double Tpay =
c.Rpay + c.Opay;
System.out.println();
System.out.println("Calculate Pay");
System.out.println("Employee Name: " + name);
System.out.println("Employee Regular Pay: " + c.Rpay);
System.out.println("Employee Overtime Pay: " + c.Opay);
System.out.println("Employee Total Pay: " + Tpay);
if (shift == 0)
{
System.out.println("Employee PayPeriod is
Friday");
} else {
System.out.println("Employee PayPeriod is
Saturday");
}
//asking user if
they want to continue to enter another employee data
System.out.println("Press Y to continue.Other key to exit ");
ch=sc.next();
} while
(ch.equalsIgnoreCase("y"));
}
}
In: Computer Science
Project Outcomes:
Develop a python program that uses:
decision constructs
looping constructs
basic operations on an list of objects (find, change, access all
elements)
more than one class and has multiple objects
Project Requirements:
1. Develop a simple Hotel program. We will have two classes, a
Hotel class
representing an individual hotel and a Room class. The Hotel class
will contain several
Room objects and will have several operations. We will also have a
driver program to test
the Hotel class.
2. Build a Hotel class that will store information about a Hotel.
It will include a name and
location. It should also include a list of class Room to hold
information about each
room. It will also have a int called occupiedCnt that keeps track
of how many rooms in
the hotel are occupied.
Specific Requirements for the Hotel Class:
1. The Hotel class has two constructors
1. __init__ function, will read in the hotel name and location from
hard-coded
values in the tester class, such as Beach Marriot Pensacola, it
will also assign
numOfRooms to zero. numOfRooms indicates how many rooms
are in the hotel.
It will create a 10 element array.
2. The Hotel will have an addRoom method that will create each
room with the required
information: room number, bed type, smoking/non-smoking, and the
room rate. Create at
least 5 rooms with different characteristics. Each room will also
have a boolean field
called occupied attribute that will be set to false when the room
is created. Don't forget
to increment the numOfRooms instance variable. Example
values for the rooms are:
101 queen s 100
102 king n 110
103 king n 88
104 twin s 100
105 queen n 99
3. The UML class diagram for the Hotel class will look like
this:
Hotel
theRooms: Array Room[]
name: String
location: String
occupiedCnt: int
numOfRooms: int
def __init(self)__(String,String)
def isFull(self) : boolean
def isEmpty(self) : boolean
def addRoom(self ,roomnumber,bedtype,smoking,price)
def addReservation(self,occupantName ,smoking,
bedtype)
def cancelReservation(self,occupantName)
def findReservation(self,occupantName):
def printReservationList(self)
def getDailySales(self) :
def occupancyPercentage(self) :
Setters and getters methods for name and location.
4. isFull() – returns a boolean that is true if all the rooms in
the hotel are occupied.
5. isEmpty() – returns a boolean that is true if all the rooms in
the hotel are unoccupied.
6. The addReservation() method takes three parameters: the
occupant’s name
(String), smoking or non-smoking request (char), and the requested
bed type (String).
When this method is called, the hotel will search the list of its
rooms for one that matches
the bed type and smoking/non-smoking attributes. If an unoccupied
room with the correct
attributes is found, the renter's name will be set and the
occupied attribute will be set
to true. In either case a message will be printed that will state
whether or not the
reservation was made.
7. When the cancelReservation() method executes, the hotel will
search for the
name of the visitor in each room. If it is found, the occupied
attribute will be set to false.
In either case a message will state whether or not the reservation
was cancelled. This
method calls the private utility method findReservation()to scan
the list of rooms
looking for a guest by name. It will return the index of the room
in the Array of rooms
or NOT_FOUND if the room is not found, which will be declared
as:
NOT_FOUND = -1;
8. findReservation() will take in a String representing the
occupant’s name and
search the occupied rooms for a reservation with that person’s
name. It will return the
index of the room or NOT_FOUND if not found.
9. printReservationList() will scan through all the rooms and
display all details
for only those rooms that are occupied. For example:
Room Number: 102
Occupant name: Pinto
Smoking room: n
Bed Type: king
Rate: 110.0
Room Number: 103
Occupant name: Wilson
Smoking room: n
Bed Type: king
Rate: 88.0
10. getDailySales() will scan the room list, adding up the dollar
amounts of the room
rates of all occupied rooms only.
11. occupancyPercentage() will divide occupiedCnt by the total
number of rooms to
provide an occupancy percentage.
12. __str__ – returns a nicely formatted string giving hotel and
room details (by calling
the __str__ in the Room class) for all the rooms in the hotel. For
example:
Hotel Name : Beach Marriot
Number of Rooms : 5
Number of Occupied Rooms : 1
Room Details are:
Room Number: 101
Occupant name: Not Occupied
Smoking room: s
Bed Type: queen
Rate: 100.0
Room Number: 102
Occupant name: Coffey
Smoking room: n
Bed Type: king
Rate: 110.0
Room Number: 103
Occupant name: Wilson
Smoking room: n
Bed Type: king
Rate: 88.0
Room Number: 104
Occupant name: Not Occupied
Smoking room: s
Bed Type: twin
Rate: 100.0
Room Number: 105
Occupant name: Not Occupied
Smoking room: n
Bed Type: queen
Rate: 99.0
13. The Room class diagram will look like this:
Room
roomNum: int
bedType: String
rate: double
occupantName: String
smoking: char
occupied: boolean
def __init__(int,String,char,double)
def getBedType(): String
def getSmoking():
char
def getRoomNum(): int
def getRoomRate(): double
def getOccupant(): String
def setOccupied(boolean)
def setOccupant(String)
def setRoomNum(int)
def setBedType(String)
def setRate(double)
def setSmoking(char)
def isOccupied(): boolean
1. The __init__() for a Room takes an int (room number), String
(bed type), char (s or n for
smoking or non-smoking)), and a double (room rate).
2. isOccupied() method returns true if the room is occupied, false
otherwise.
3. __str__() provides all the details of a room - room number,
name of guest(if
occupied) , bed type, smoking/non-smoking, rental rate. This should
all be formatted
nicely with one attribute on each line using the
'\n' escape character. See example above.
4. Several accessor and mutator methods for the Room class.
# Use list to store the room details.
You have to store required data in the list/database. You can store
hotel name, address, and
all rooms. Customer data in database tables.
In: Computer Science
Data Structure
17.
Given: (e + f) / a – b * c
Write out the postfix form
19. Make a prototype, including task, input and output, of compareLists that would take two lists of reference (ArrayList) and return a count of matching items (note, do NOT code the function)
20.Using the Stack operations, write a pseudocode routine, dupPos, that takes aStack for integers, checks to see if the top is positive. If positive, duplicate the top of the stack (i.e. pop a copy of that value onto the stack). If it is negative, pop it off.
21.Use the ListInterface operations only to create a makeEven routine in C++ that will take a list of integers (array or linked, your choice) as a reference. Use the list operations on the passed list to make all items that are odd into even values.
22.What is the main difference between an ADT List and the ADT Stack?
In: Computer Science
Show that Turing-decidable languages are closed under the following operations:
union
concatenation
star
Show that Turing-recognizable languages are closed under the following operations:
union
concatenation
star
Each answer needs only be a short informal description of a Turing Machine (but it must still be sufficiently precise so someone could reconstruct a formal machine if needed).
In: Computer Science
In: Computer Science
Use only three context selectors SPACE, >, and +, add document level CSS code to the HTML file below to implement styles required in the body portion of the HTML file.
<body>
<p> Here should be yellow </p> <div>
<p> Here should be cyan </p> <div>
Content of this division should be brown
<p> Some text </p> </div>
<p> Here should be red </p> <p> Here should be green </p> <div>
<p> Here should be brown </p> <div>
<p> Here should be pink </p> </div>
</div> </div>
<p> Here should be blue </p> </body>
2) Use minimal number of selectors, otherwise 10 points deduction will be applied.
1) Only three context selectors specified above can be used. Using other
selectors or other types of CSS code, i.e. inline CSS or external CSS, will
cause 50 points deduction.
In: Computer Science
The command below produces a row vector of 100 random values uniformly distributed between -10 and +10.
r = 10.*rand(1,100)-10;
r = 20.*rand(1,100)-10;
r = -10.*rand(1,100)+10;
r = 10.*rand(1,100)-20;
In: Computer Science
Suppose you are given a list of n integers, each of size at most 100n. How many operations would it take you to do the following tasks (in answering these questions, we are interested primarily in whether it will take logn, sqrt(n), n, n^2, n^3, 2^n, ... steps. In other words, ignore multiplicative constants.)
1. Determine the longest sequence of consecutive integers belonging to the list.
2. Determine the number of primes in the list.
3. Determine whether there are three integers x, y and z from the list so that x + y = z.
4. Determine whether there are three integers x, y, and z from the list so that x^2 + y^2 = z^2.
In: Computer Science
Plot a dot matric using the sliding window 1 nucleotides long and setting up a stringency threshold of 1 out 1 matches for putting a dot in the relevant element on the dot matrix. Draw a line on the dot matrix and write down the corresponding alignment between these two sequences.
AACTAGCCCCATGCAAGCATT
ACTAGCGCGCCTCATGCAGCATT
In: Computer Science
In: Computer Science
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program:
Min miles: -10 Max miles: 40
#include <iostream>
using namespace std;
int main() {
const int NUM_ROWS = 2;
const int NUM_COLS = 2;
int milesTracker[NUM_ROWS][NUM_COLS];
int i;
int j;
int maxMiles = -99; // Assign with first element in milesTracker
before loop
int minMiles = -99; // Assign with first element in milesTracker
before loop
int value;
for (i = 0; i < NUM_ROWS; i++){
for (j = 0; j < NUM_COLS; j++){
cin >> value;
milesTracker[i][j] = value;
}
}
/* Your solution goes here */
cout << "Min miles: " << minMiles <<
endl;
cout << "Max miles: " << maxMiles << endl;
return 0;
}
In: Computer Science