What are the 3 goals of computer security, define them
Design a Authentication mutual protocol not subject to reflection attack
What are 3 types of hashing. Draw a diagram of hash function
What is a memory layout. Draw an example
Describe Buffer Flow attack
In: Computer Science
1. Insight into RF systems
a. Would a high-gain dish antenna be suitable for use as the antenna at the base station in a PtMP (Point to Multi-Point) setup, yes or no? Explain your answer.
2. Radio frequency terminology:
Research and concisely describe the following RF terms:
In: Computer Science
In JAVA
• Write a program that calculates the average of a group of test
scores, where the
lowest score in the group is dropped. It should use the following
methods:
• int getScore() should ask the user for a test score, store it in
a reference
parameter variable, and validate it. This method should be called
by main once
for each of the five scores to be entered.
• void calcAverage() should calculate and display the average of
the four highest scores.
This method should be called just once by main, and should be
passed
the five scores.
• int findLowest() should find and return the lowest of the five
scores passed to it.
It should be called by calcAverage, which uses the method to
determine one of
the five scores to drop.
The program should display a letter grade for each score and the
average test
score.
Input Validation: Do not accept test scores lower than 0 or higher
than 100.
*******(use random numbers 50-100. Don't ask the user to enter
data)
********Show all test scores, the one that got dropped and the
average.
*******For random numbers, use the Random class not Math.random()
In: Computer Science
Data Models
1. What is a business rule, and what is its purpose in data modeling?
2. What is a relationship, and what three types of relationships exist?
3. What is a table, and what role does it play in the relational model?
In: Computer Science
create code for an address book console program in C++ that:
In: Computer Science
The files Firm.java, Staff.java, StaffMember.java, Volunteer.java, Employee.java, Executive.java, and
Hourly.java are from Listings 10.1 - 10.7 in the text. The program illustrates inheritance and polymorphism.
In this exercise you will add one more employee type to the class hierarchy (see Figure 9.1 in the text).
The employee will be one that is an hourly employee but also earns a commission on sales. Hence the class, which we’ll name Commission, will be derived from the Hourly class.
Write a class named Commission with the following features:
To test your class, update Staff.java as follows:
Compile and run the program. Make sure it is working properly.
//*****************************************************************
// Firm.java Author: Lewis/Loftus
//
// Demonstrates polymorphism via inheritance.
// ****************************************************************
public class Firm
{
//--------------------------------------------------------------
// Creates a staff of employees for a firm and pays them.
//--------------------------------------------------------------
public static void main (String[] args)
{
Staff personnel = new Staff();
personnel.payday();
}
}
//********************************************************************
// Staff.java Author: Lewis/Loftus
//
// Represents the personnel staff of a particular business.
//********************************************************************
public class Staff
{
StaffMember[] staffList;
//-----------------------------------------------------------------
// Sets up the list of staff members.
//-----------------------------------------------------------------
public Staff ()
{
staffList = new StaffMember[6];
staffList[0] = new Executive ("Sam", "123 Main Line", "555-0469", "123-45-6789", 2423.07);
staffList[1] = new Employee ("Carla", "456 Off Line", "555-0101", "987-65-4321", 1246.15);
staffList[2] = new Employee ("Woody", "789 Off Rocker", "555-0000", "010-20-3040", 1169.23);
staffList[3] = new Hourly ("Diane", "678 Fifth Ave.", "555-0690", "958-47-3625", 10.55);
staffList[4] = new Volunteer ("Norm", "987 Suds Blvd.", "555-8374");
staffList[5] = new Volunteer ("Cliff", "321 Duds Lane", "555-7282");
((Executive)staffList[0]).awardBonus (500.00);
((Hourly)staffList[3]).addHours (40);
}
//-----------------------------------------------------------------
// Pays all staff members.
//-----------------------------------------------------------------
public void payday ()
{
double amount;
for (int count=0; count < staffList.length; count++)
{
System.out.println (staffList[count]);
amount = staffList[count].pay(); // polymorphic
if (amount == 0.0)
System.out.println ("Thanks!");
else
System.out.println ("Paid: " + amount);
System.out.println ("------------------------------------");
}
}
}
//******************************************************************
// StaffMember.java Author: Lewis/Loftus
//
// Represents a generic staff member.
//******************************************************************
abstract public class StaffMember
{
protected String name;
protected String address;
protected String phone;
//---------------------------------------------------------------
// Sets up a staff member using the specified information.
//---------------------------------------------------------------
public StaffMember (String eName, String eAddress, String ePhone)
{
name = eName;
address = eAddress;
phone = ePhone;
}
//---------------------------------------------------------------
// Returns a string including the basic employee information.
//---------------------------------------------------------------
public String toString()
{
String result = "Name: " + name + "\n";
result += "Address: " + address + "\n";
result += "Phone: " + phone;
return result;
}
//---------------------------------------------------------------
// Derived classes must define the pay method for each type of
// employee.
//---------------------------------------------------------------
public abstract double pay();
}
//******************************************************************
// Volunteer.java Author: Lewis/Loftus
//
// Represents a staff member that works as a volunteer.
//******************************************************************
public class Volunteer extends StaffMember
{
//---------------------------------------------------------------
// Sets up a volunteer using the specified information.
//---------------------------------------------------------------
public Volunteer (String eName, String eAddress, String ePhone)
{
super (eName, eAddress, ePhone);
}
//---------------------------------------------------------------
// Returns a zero pay value for this volunteer.
//---------------------------------------------------------------
public double pay()
{
return 0.0;
}
}
//******************************************************************
// Employee.java Author: Lewis/Loftus
//
// Represents a general paid employee.
//******************************************************************
public class Employee extends StaffMember
{
protected String socialSecurityNumber;
protected double payRate;
//---------------------------------------------------------------
// Sets up an employee with the specified information.
//---------------------------------------------------------------
public Employee (String eName, String eAddress, String ePhone,
String socSecNumber, double rate)
{
super (eName, eAddress, ePhone);
socialSecurityNumber = socSecNumber;
payRate = rate;
}
//---------------------------------------------------------------
// Returns information about an employee as a string.
//---------------------------------------------------------------
public String toString()
{
String result = super.toString ();
result += "\nSocial Security Number: " + socialSecurityNumber;
return result;
}
//---------------------------------------------------------------
// Returns the pay rate for this employee.
//---------------------------------------------------------------
public double pay()
{
return payRate;
}
}
//******************************************************************
// Executive.java Author: Lewis/Loftus
//
// Represents an executive staff member, who can earn a bonus.
//******************************************************************
public class Executive extends Employee
{
private double bonus;
//-----------------------------------------------------------------
// Sets up an executive with the specified information.
//-----------------------------------------------------------------
public Executive (String eName, String eAddress, String ePhone,
String socSecNumber, double rate)
{
super (eName, eAddress, ePhone, socSecNumber, rate);
bonus = 0; // bonus has yet to be awarded
}
//-----------------------------------------------------------------
// Awards the specified bonus to this executive.
//-----------------------------------------------------------------
public void awardBonus (double execBonus)
{
bonus = execBonus;
}
//-----------------------------------------------------------------
// Computes and returns the pay for an executive, which is the
// regular employee payment plus a one-time bonus.
//-----------------------------------------------------------------
public double pay()
{
double payment = super.pay() + bonus;
bonus = 0;
return payment;
}
}
//******************************************************************
// Hourly.java Author: Lewis/Loftus
//
// Represents an employee that gets paid by the hour.
//*******************************************************************
public class Hourly extends Employee
{
private int hoursWorked;
//-----------------------------------------------------------------
// Sets up this hourly employee using the specified information.
//-----------------------------------------------------------------
public Hourly (String eName, String eAddress, String ePhone,
String socSecNumber, double rate)
{
super (eName, eAddress, ePhone, socSecNumber, rate);
hoursWorked = 0;
}
//-----------------------------------------------------------------
// Adds the specified number of hours to this employee's
// accumulated hours.
//-----------------------------------------------------------------
public void addHours (int moreHours)
{
hoursWorked += moreHours;
}
//-----------------------------------------------------------------
// Computes and returns the pay for this hourly employee.
//-----------------------------------------------------------------
public double pay()
{
double payment = payRate * hoursWorked;
hoursWorked = 0;
return payment;
}
//-----------------------------------------------------------------
// Returns information about this hourly employee as a string.
//-----------------------------------------------------------------
public String toString()
{
String result = super.toString();
result += "\nCurrent hours: " + hoursWorked;
return result;
}
}
In: Computer Science
Hello, I need to come up with the java code for a program that looks at bank Account ID's and checks if it is in the frame work of Letter followed by 4 numbers, so for example "A001". I need it to be its own method, named checkAccountID() that passes the accountID as an argument to check if it is in that framework of one letter followed by 4 numbers. Any ideas?
In: Computer Science
Create an application that allows you to enter student data than consists of an ID number, first name, last name, and grade point average. If the student's GPA is less than 2.0, write the record to an academic probation file, otherwise, write the record to a good standing file Once the student records are complete, read in the good standing file. If the GPA is greater than or equal to 3.5, display the students name for the Dean's List Be sure to include any exceptions needed for the program to run smoothly. Save the file as StudentsStanding.java I've figured out the first part in writing the files, but having trouble with reading in the files to make the Dean's List.
In: Computer Science
Done in C++ please. And use #include iostream, string, and fstream. do not use #include algorithm.
Question 1 In this question, you will read words from a file and place them into an array of type string.
1- Make a data text file “words.txt” – that contains one word on each line. Use at least 20 words.
2- Now write a program that reads the words in the file into an array of strings (a repeated word should not be inserted into the array – your program should not allow that and you should make sure your data file has duplicate words to test this functionality). Make your array size enough to hold 1000 words. To read the words into the array, you should make a function that takes a string array, a data size integer (dsize) by reference and an ifstream – please look at the example we did in class.
3- Declare your array and file streams in main and call the function that reads the data into the array.
4- Write a printArray function that takes a string array, the dsize and an ostream object so that you could print to the console or to an output file.
5- Print your array from main by calling the printArray function – once to the console and once to a file “wordsoutput.txt”.
6- Use the selectionSort Algorithm that we covered in class to sort the array.
7- Repeat #5 and make sure the array is sorted.
8- Find the maximum string and the minimum string in the array (remember arrays are compared based on the ASCII value).
9- Write a function that takes a string and converts every character of it to uppercase. Now call that function from a function that you pass the array and dsize to, to uppercase all words in the array (convert all words in the array to uppercase letter) and call that from main passing your array to that function. Print the array.
In: Computer Science
Kindly type the answer but don't copy and paste - 250 words
Compare and contrast the Linear Classifier and Decision Tree Classifier
In: Computer Science
0. Introduction.
This laboratory assignment involves designing a perfect hash function for a small set of strings. It demonstrates that a perfect hash function need not be hard to design, or hard to understand.
1. Theory.
We’ll start by reviewing some terminology from the lectures. A
hash function is a function that takes a key as
its argument, and returns an index into an array. The array is
called a hash table. The object that appears at the index
in that array is the key’s value.The key’s value is
somehow associated with the key.
A hash function may return the same
index for two different keys. This is called a collision.
Collisions are undesirable if we want distinct values to be
associated with distinct keys. A hash function that has no
collisions for a set of keys is said to be perfectfor that
set. Note that a hash function may be perfect for some sets of
keys, but not perfect for others.
Most modern programming languages
use a small set of reserved names as operators,
punctuation, and syntactic markers. (They’re also called
reserved words or keywords.) For example, Java
currently uses reserved names like if, private, while, etc.
A compiler for a programming
language must be able to test if a name in a program is reserved.
Programs may be hundreds or thousands of pages long, and may
contain thousands or even millions of names. As a result, the test
must be done efficiently. It might be implemented using a hash
table and a perfect hash function.
Here’s how the test may work.
Suppose that the hash table T is an array of strings. Each
time the compiler reads a name N, it calls a perfect hash
function h to compute an index h(N). If
h(N) is a legal index for T, and
T[h(N)] = N, then the name is
reserved, otherwise it is not. Unused elements of T might
be empty strings "". If we measure the efficiency of a test by the
number of string comparisons it performs, then the test requires
only O(1) comparisons. Of course this works only if
h is perfect for the set of reserved names.
Now suppose there is a very simple
programming language that uses the following set of twelve reserved
names.
and |
else |
or |
begin |
end |
return |
define |
if |
then |
do |
not |
while |
We might define a perfect hash function for the reserved names
in the following way. We get one or more characters from each name.
Then we convert each character to an integer. This is easy, because
characters are already represented as small nonnegative integers.
For example, in the ASCII and Unicode character sets, the
characters 'a' through 'z' are represented as the integers 97
through 122, without gaps. Finally, we do some arithmetic on the
integers to obtain an index into the hash table. We choose the
characters, and the arithmetic operations, so that no two reserved
names result in the same index.
For example, if we define the hash
function h so that it adds the first and second characters
of each name, we get the following indexes.
h("and") |
= |
207 |
h("begin") |
= |
199 |
h("define") |
= |
201 |
h("do") |
= |
211 |
h("else") |
= |
209 |
h("end") |
= |
211 |
h("if") |
= |
207 |
h("not") |
= |
221 |
h("or") |
= |
225 |
h("return") |
= |
215 |
h("then") |
= |
220 |
h("while") |
= |
223 |
This definition for h does not result in a perfect hash function, because it has collisions. For example, the strings "and" and "if" result in the index 207. Similarly, the strings "do" and "end" result in the index 211. We either didn’t choose the right characters from each string, or the right operations to perform on those characters, or both. Unfortunately, there is no good theory about how to define h. The best we can do is try various definitions, by trial and error, until we find one that is perfect.
2. Implementation.
Design a perfect hash function for the reserved names shown in the previous section. To do that, write a small test class, something like this, and run it with various definitions for the function hash. It calls hash for each reserved name, and writes indexes to standard output.
class Test
{
private static final String [] reserved
=
{ "and",
"begin",
"define",
"do",
"else",
"end",
"if",
"not",
"or",
"return",
"then",
"while" };
private static int hash(String name)
{
// Your code goes
here.
}
public static void main(String []
args)
{
for (int index = 0; index <
reserved.length ; index += 1)
{
System.out.print("h(\"" +
reserved[index] + "\") = ");
System.out.print(hash(reserved[index]));
System.out.println();
}
}
}
When defining hash, you might try adding characters at specific
indexes from each name. You might try linear combinations of the
characters: that is, multiplying the characters by small constants,
then adding or subtracting the results. You might try the operator
%. You might also try a mixture of these. Whatever you try, reject
any definition of hash that is not perfect: one that returns the
same index for two different names.
Your method hash must work in
constant time, without loops or recursions. It must not use if’s or
switch’es. It must not call the Java method hashCode, because that
uses a loop, and so does not work in O(1) time. It must
not return negative integers, because they can’t be array
indexes.
The character at index k in
name is obtained by name.charAt(k). Characters in Java
Strings are indexed starting from 0, and ending with the length of
the string minus 1. For example, the first character from name is
returned by name.charAt(0), the second character by name.charAt(1),
and the last character by name.charAt(name.length() - 1).
Don’t worry if there are gaps
between the indexes: your hash function need not be
minimal. Also, try to keep the returned indexes small:
they shouldn’t exceed 2000. For example, I know a perfect hash
function for the reserved words in this assignment, whose indexes
range from 1177 to 1413. I found it after about ten minutes of
trial-and-error search.
In: Computer Science
A JavaFX question
a method called generate2Num(Pane, pane){};
A botton "botton1" that botton.setOnAction(e-> {}); calling generate2Num method and show the numbers on Scene.
Every time the user clicks botton1, the updated number will show on the Scene.
I just wanna know how can I update my data by click the button.
Please show the code , thank you
In: Computer Science
Write a program to sort the student’s names (ascending order), calculate students’ average test scores and letter grades (Use the 10 point grading scale). In addition, count the number of students receiving a particular letter grade. You may assume the following input file data :
Johnson 85 83 77 91 76
Aniston 80 90 95 93 48
Cooper 78 81 11 90 48
Gupta 92 83 30 69 87
Muhammed 23 45 96 38 59
Clark 60 85 45 39 67
Patel 77 31 52 74 83
Abara 93 94 89 77 97
Abebe 79 85 28 93 82
Abioye 85 72 49 75 63
(40%) Use four arrays: a one-dimensional array to store the students’ names, a (parallel) two dimensional array to store the test scores, a one-dimensional array to store the student’s average test scores and a one-dimensional array to store the student’s letter grades.
(60%) Your program must contain at least the following functions :
A function to read and store data into two arrays,
A function to calculate the average test score and letter grade,
A function to sort all the arrays by student name, and
A function to output all the results (i.e. sorted list of students and their corresponding grades)
Have your program also output the count of the number of students receiving a particular letter grade.
NOTE : No non-constant global variables are to be used. You can name the arrays and functions anything you like. You can use the operator >= to sort the strings.
In C++
In: Computer Science
The hexademical number system uses base 16 with digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Hexadecimal is often used in computer systems programming. Write a Python program, in a file called convertHex.py, to request a decimal number from the user and output the hexadecimal value. To compute the hexadecimal value we have to find the hexadecimal digits hn, hn-1, hn-2, ..., h2, h1, and h0, such that
d = hn x 16n + hn-1 x 16n-1 + hn-2 x 16n-2 + ... + h2 x 162 + h1 x 161 + h0 x 160
These hexadecimal digits can be found by successively dividing d by 16 until the quotient is 0; the remainders are h0, h1, ..., hn-1, hn.
For example, if d=589:
So 589 in decimal is 24D in hexadecimal.
Your program should include the following functions:
Sample output:
Enter decimal value: 589 589 is equal to 24D in hexadecimal
In: Computer Science
WEEK 3 DISCUSSION# 4
ANSWER THE FOLLOWING :
1: Fully explain how to use one of the threat modeling tools
2: What are the benefits or issues with Microsoft’s Threat Modeling process and tool?
In: Computer Science