2) Show how each of the following signed, decimal integers would be stored in 16-bit two's complement format. Give your answer in hexadecimal.
a) -21 (5 points)
b) 4096 (5 points)
In: Computer Science
* what are some negative consequences of IT security?
* what are the 4 ways to respond to risk give example? *
give example of information that an employee should not reveal?
In: Computer Science
You are asked to design a database to support a Instant Recruitment System of casual staff for a school. The major business requirements are summarised below in the Mini Case: An Instant Recruitment System. You are asked to develop a detailed Entity-Relationship model for this mini case. Your ER model should consist of a detailed ER diagram integrated with itemised discussions on the features of the entities and relationships and all the assumptions you made where applicable. The ER diagram and the accompanying document should identify keys, constraints, entity types, relationship types, specialisation/generalisation if any, etc. You must use the same notation scheme for the ER diagram as the textbook (use UML notations as shown in the last page of the textbook, and don't use Crew Foot notations), and the ER diagram should be strictly in the way the textbook uses for.
In: Computer Science
write a python script to calculate the return of a stock with 10years of historical data/returns
In: Computer Science
Please solve all parts of the following question on MATLAB.
1. Penn State football travels to Ohio State to play the Buckeyes on Nov 23, 2019. The official capacity of Ohio Stadium is 104,944. Let’s say that the stadium is filled at the beginning of the game, but every time Penn State scores a touchdown half of the fans leave. How many touchdowns does Penn State have to score until there is just one fan left in the stadium?
a. construct a two-column matrix in which one column is number of touchdowns and the other column is number of people in the stadium.
b. plot touchdown number vs. number of fans on linear axes. The satisfactory plot will include: a title, and labeled axes. Since you are plotting discrete data points, please plot them with a symbol and connect the symbols with a line. All fonts should be large enough to be legible. You may choose the aspect ratio of your plot and what kind of symbol and line style to use.
c. redo the plot, but this time with a logarithmic y axis.
In: Computer Science
Describe the difference between classification, clustering, and association rules. Be specific and provide details.
In: Computer Science
Python Problem
Problem 1:
In this problem you are asked to write a Python program to find the greatest and smallest elements in the list.
The user gives the size of the list and its elements (positive and negative integers) as the input.
Sample Output:
Enter size of the list: 7
Enter element: 2
Enter element: 3
Enter element: 4
Enter element: 6
Enter element: 8
Enter element: 10
Enter element: 12
Greatest element in the list is: 12
Smallest element in the list is: 2
Hit enter to end program
------------------------------------------------------------------------------------------
Problem 2:
In this problem you are asked to write a Python program you are asked to perform multiple operations on a list.
What you need to do:
Ask the user what is the length of the list.
Ask the user to enter string values into a list.
Print the first 4 and last 4 elements in the list.
Ask the user if he/ she wants to insert elements to the list or delete the elements from the list.
Repeat step 4 until the user chooses a ‘NO’.
Sample Output:
Enter size of list: 5
Enter a string value: john Enter a string value: mary
Enter a string value: steve
Enter a string value: julia
Enter a string value: jake
The elements in the list:
['john', 'mary', 'steve', 'julia', 'jake']
The first four elements in the list: ['john', 'mary', 'steve', 'julia']
The last four elements in the list: ['mary', 'steve', 'julia', 'jake']
Want to insert (i) or delete (d) elements in the list: i Enter
the position to insert: 5
Enter the value to insert: lara
The modified list:
['john', 'mary', 'steve', 'julia', 'jake', 'lara']
Want to insert or delete more elements (y/n): y
Want to insert (i) or delete (d) elements in the list: i Enter
the position to insert: 2
Enter the value to insert: Jacob
The modified list:
['john', 'mary', 'jacob', 'steve', 'julia', 'jake', 'lara']
Want to insert or delete more elements (y/n): y
Want to insert (i) or delete (d) elements in the list: d Enter the index of the value to be deleted: 4
The modified list:
['john', 'mary', 'jacob', 'steve', 'jake', 'lara']
Want to insert or delete more elements (y/n): n
Hit enter to end program
In: Computer Science
# print out the steps to make chex mix, taking into account whether or not to include peanuts
# Here is the pseudo code we developed earlier:
#
#Get Bowl
#Add wheat Chex
#Add cheez-its
#Add Pretzels
#Add m & ms (why? – just taking it from the video…)
#If no peanut allergy
# Add peanuts
#else (there was a peanut allergy)
# if we have another bowl
# get second bowl
# put some of the mix so far into the second bowl
# add peanuts to second bowl
# else (at this point there was a peanut allergy, but no second
bowl)
# don’t do anything. We’re done.
# Here is the start of the Python code
print("Get Bowl")
print("Add wheat chex to bowl")
print("Add cheez-its to bowl")
print("Add pretzels to bowl")
print("Add m & ms to bowl")
# Note that the string in the following prompt has embedded
single quotes inside double quotes
peanut_allergy = input("Is there a peanut allergy? (enter 'yes' or
'no')")
# finish the code
# when it's time to ask for the second bowl, use this as the
prompt:
# "Is there a second bowl? (enter 'yes' or 'no')"
In: Computer Science
Referencing SQL Databases
Elaborate on a scenario where you can apply data manipulation commands and transaction controls.
In: Computer Science
1. Given the network 192.168.17.0 /24, calculate the broadcast, range and last host address for the fourth subnet, given that the all-zeros subnet is the first subnet if you have to create 15 subnets.
2. Given an IP network of 180.5.0.0 /16, calculate the subnet mask required to create 50 subnets with the maximum number of hosts. Then calculate the network address, the range of useable host addresses and the broadcast address of the LAST 3 subnets.
In: Computer Science
Ethic IT short topic:
Research and discuss some of the most recent efforts of Facebook and other popular social media companies to reduce the number of bad actors who use their technology. Will these efforts be effective, or will bad actors always find a way to get by whatever Facebook and other platforms like it put in the way to stop them? Make suggestions as to how the efforts to stop bad social media behavior can be improved. Touch on the use of Fake News and the creation of accounts that don’t actually belong to a person.
In: Computer Science
In: Computer Science
Create a DataEntryException class whose getMessage() method returns information about invalid integer data. Write a program named GetIDAndAge that continually prompts the user for an ID number and an age until a terminal 0 is entered for both. If the ID and age are both valid, display the message ID and Age OK.
Throw a DataEntryException if the ID is not in the range of valid ID numbers (0 through 999), or if the age is not in the range of valid ages (0 through 119). Catch any DataEntryException or InputMismatchException that is thrown, and display the message Invalid age or ID - DataEntryException - \, where \ is the value of the invalid input. For example:
Enter ID 1000 Enter age 40 Invalid age or ID - DataEntryException
=============================================
public class DataEntryException extends Exception {
public DataEntryException(int num) {
}
}
==================================================
import java.util.*;
public class GetIDAndAge {
public static void main(String[] args) {
int id;
int age;
final int QUIT = 0;
int returnVal = QUIT + 1;
Scanner keyboard = new Scanner(System.in);
while (returnVal != QUIT) {
// Write your code here
}
}
public static int check(int idNum, int ageNum) throws
DataEntryException {
// Write your code here
}
public static void showStatus(String msg) {
// Write your code here
}
}
In: Computer Science
The Rapid Response Refurbishment Company is a large company whose sole job is to refurbish consignments of faulty electronics goods for major manufacturers. The Company currently operates 50 Refurb_Centers. The company is is overhauling its information system, a necessary step after the computer the records were held on died irrecoverably in April.
The new system will be created using a traditional relational database system. You have been called in as a contractor to design the database. Your first task is to create the conceptual design which will be a conceptual entity relationship diagram (ERD).
You will take the information presented herein and represent it as a set of entity types and their primary keys and some major attributes and the relationships between the entity types (not instances).
The following narrative was provided by the CEO Tractatus Querulous.
The company was formed in 1997 and has grown substantially. As you probably know we have 50Refurb_Centers. Basically one in every state even Alaska. We deal with large consignments of faulty goods. Manufacturers outsource the refurb Projects to us instead of having to set up new facilities to do the jobs themselves. We contract with manufacturers to take on refurbishment Projects.
Each Refurb_Centers handles multiple Projects and each Project is assigned exclusively to one specificRefurb_Center based on proximity to the manufacturer and current workload.
Each Project consists of multiple Items and each Item belongs to just one Project. To repair a single Item often requires many different Tasks (Disassembly, Diagnostics, repair, reassembly and so on). Each Task is uniquely identified and applies to a single Item.
Tasks of course require someone to do them, often several someones. Each Task may require the services of many Technicians and of course each Technician will do many Tasks. This is one of those problematic many to many relationships. For this exercise you are allowed to show many to many relationships.
Tasks of course also require tools, materials, or other equipment to do them, often several pieces. For simplicity we refer to all of these things as Kit. Each Task may require many bits of Kit and of course each bit of Kit may be used on many Tasks. This is another one of those annoying Many to Many relationships. For this exercise you are allowed to show many to many relationships.
Each bit of Kit has a single Supplier and each Supplier supplies us with many bits of Kit.
To keep our techs honest we assign each and every bit of Kit (down to reels of copper wire or packets of solder) to one specific Technician. Each technician will have many bits of kit assigned to them. We call Toby Esterhase "Sargent Solder" as he always has about a ton of the stuff on hand, but don't expect to borrow any of it from him, he is as tight as a gnats chuff.
To make sure our techs are both properly skilled and up to date about the items they refurbish we make sure they all attend 2 or 3 Training_Courses per year. Each Training_Course involves between 5 and 20 Techs and each Tech as mentioned attends several courses. Guess what this is? Yep, tis yet another many to many relationships. For this exercise you are allowed to show many to many relationships.
Part One
You will create a conceptual ERD. The ERD will show a rectangle for each entity type which will be split in two. The top half will include the Entity type name as a singular noun so Technician not Technicians (points will be deducted for every mistake) .
The bottom half will list the attribute(s) used to create the primary key (guarantee uniqueness for each instance). As the CEO has given you few clues you may exercise your creativity, if you can find a natural set of attributes that guarantee uniqueness use them if not define your own primary key.
Relationships between entities will be shown by a line with a relationship name and an arrow
pointing towards the "possessed" or object entity for instance
Part two
The ERD is the first part - the second part is a list of important non-key attributes for each entity (plus the primary key), for instance for an entity called Necromancer you might list it thusly…
|
Necromancer |
|
Necromancer_ID{PK} Fname Sname Dateofbirth Datewentinsane Dateofdeath Dateofreturn Street City State Country Planet |
However, for this exercise have no more than about 6 non-key attributes for each entity type (plus the primary key {pk} as above, but you must list some attributes for all entity types if you come up with an entity type and you cannot think of any attributes for it that's a big hint that it probably is not a terrific entity type after all. The challenge here is to come up with a set of important attributes that we will want to know about each entity instance
As this is a conceptual ERD do not create Foreign Keys
You may use any diagramming tool to create the ERD and attributes lists as long as I can read them.
Far and away the easiest tool for this job is creaky old PowerPoint which can draw rectangles, lines, triangles, and text boxes dead easy and stuff can be easily scaled. PP Hints coming soon…
A Huge helpful Hint
Long before you even draw the first box in PowerPoint (or whatever you use) you are strongly advised to scope out your design on paper, yes good old wood pulp, cleaned, bleached, compressed, dried then shaped into very thin rectangles…
In: Computer Science
// TASK #2 Add an import statement for the Scanner class
// TASK #2(Alternate)
// Add an import statement for the JOptionPane class
/**
This program demonstrates how numeric types and
operators behave in Java.
*/
public class NumericTypes
{
public static void main (String [] args)
{
// TASK #2 Create a Scanner object here
// (not used for alternate)
// Identifier declarations
final int NUMBER = 2 ; // Number of scores
final int SCORE1 = 100; // First test score
final int SCORE2 = 95; // Second test score
final int BOILING_IN_F = 212; // Boiling temperature
int fToC; // Temperature Celsius
double average; // Arithmetic average
String output; // Line of output
// TASK #2 declare variables used here
// TASK #3 declare variables used here
// TASK #4 declare variables used here
// Find an arithmetic average.
average = (SCORE1 + SCORE2) / NUMBER;
output = SCORE1 + " and " + SCORE2 +
" have an average of " + average;
System.out.println(output);
// Convert Fahrenheit temperature to Celsius.
fToC = 5/9 * (BOILING_IN_F - 32);
output = BOILING_IN_F + " in Fahrenheit is " +
fToC + " in Celsius.";
System.out.println(output);
System.out.println(); // To leave a blank line
// ADD LINES FOR TASK #2 HERE
// Prompt the user for first name
// Read the user's first name
// Prompt the user for last name
// Read the user's last name
// Concatenate the user's first and last names
// Print out the user's full name
System.out.println(); // To leave a blank line
// ADD LINES FOR TASK #3 HERE
// Get the first character from the user's first name
// Print out the user's first initial
// Convert the user's full name to uppercase
// Print out the user's full name in uppercase
System.out.println(); // To leave a blank line
// ADD LINES FOR TASK #4 HERE
// Prompt the user for a diameter of a sphere
// Read the diameter
// Calculate the radius
// Calculate the volume
// Print out the volume
}
}
Task #2a Using the Scanner Class for User Input (4 pts)
⦁ Add an import statement above the class declaration
to make the Scanner class available to your program.
⦁ In the main method, create a Scanner object and
connect it to the System.in object.
⦁ Prompt the user to enter his or her first name.
⦁ Read the name from the keyboard using the nextLine
method and store it into a variable called firstName (you will need
to declare any variables you use).
⦁ Prompt the user to enter his or her last name.
⦁ Read the name from the keyboard and store it in a
variable called lastName.
⦁ Concatenate the firstName and lastName with a space
between them and store the result in a variable called
fullName.
⦁ Print out the fullName.
⦁ Compile, debug, and run, using your name as test
data.
⦁ Since we are adding on to the same program, each time
we run the program we will get the output from the previous tasks
before the output of the current task.
Task #2b (alternate) Using Dialog Boxes for User Input (4
pts)
⦁ Add an import statement above the class declaration
to make the JOptionPane class available to your program.
⦁ In the main method, prompt the user to enter his or
her first name by displaying an input dialog box and storing the
user input in a variable called firstName (you will need to declare
any variables you use).
⦁ Prompt the user to enter his or her last name by
displaying an input dialog box and storing the user input in a
variable called lastName.
⦁ Concatenate the firstName and lastName with a space
between them and store the result in a variable called
fullName.
⦁ Display the fullName using a message dialog
box.
⦁ Compile, debug, and run, using your name as test
data.
⦁ Since we are adding on to the same program, each time
we run the program we will get the output from the previous tasks
before the output of the current task.
Task #3 Working with Strings (4 pts)
⦁ Use the charAt method to get the first character in
firstName and store it in a variable called firstInitial (you will
need to declare any variables that you use).
⦁ Print out the user’s first initial.
⦁ Use the toUpperCase method to change the fullName to
uppercase and store it back into the fullName variable.
⦁ Add a line that prints out the value of fullName and
how many characters (including the space) are in the string stored
in fullName (use the length method to obtain that
information).
⦁ Compile, debug, and run. The new output added on
after the output from the previous tasks should have your initials
and your full name in uppercase.
Task #4 Using Predefined Math Functions (4 pts)
⦁ Add a line that prompts the user to enter the
diameter of a sphere.
⦁ Read in and store the number into a variable called
diameter (you will need to declare any variables that you
use).
⦁ The diameter is twice as long as the radius, so
calculate and store the radius in an appropriately named
variable.
⦁ The formula for the volume of a sphere is:
r3
Convert the formula to Java code and add a line which calculates
and stores the value of volume in an appropriately named variable.
Use Math.PI for and Math.pow to cube the radius.
⦁ Print your results to the screen with an appropriate
message.
⦁ Compile, debug, and run using the following test data
and record the results.
Diameter Volume (hand calculated) Volume
(resulting output)
2
25.4
875,000
Task #5 Create a program from scratch (4 pts)
In this task you will create a new program that calculates gas
mileage in miles per gallon. You will use string expressions,
assignment statements, input and output statements to communicate
with the user.
⦁ Create a new file in your IDE or text
editor.
⦁ Create the shell for your first program by
entering:
public class Mileage
{
public static void main(String[] args)
{
// Add your declaration and code
here.
}
}
⦁ Save the file as Mileage.java.
⦁ Translate the algorithm below into Java code. Don’t
forget to declare variables before they are used. Each variable
must be one word only (no spaces).
Print a line indicating this program will calculate mileage
Print prompt to user asking for miles driven
Read in miles driven
Print prompt to user asking for gallons used
Read in gallons used
Calculate miles per gallon by dividing miles driven by gallons
used
Print miles per gallon along with appropriate labels
⦁ Compile the program and debug, repeating until it
compiles successfully.
⦁ Run the program and test it using the following sets
of data and record the results:
Miles driven Gallons used Miles per
gallon (hand calculated) Miles per gallon
(resulting output)
2000 100
500 25.5
241.5 10
100 0
⦁ The last set of data caused the computer to divide
100 by 0, which resulted in what is called a runtime error. Notice
that runtime can occur on programs which compile and run on many
other sets of data. This emphasizes the need to thoroughly test you
program with all possible kinds of data.
Task #6 Documenting a Java Program (2 pts)
⦁ Compare the code listings of NumericTypes.java with
Mileage.java. You will see that NumericTypes.java has lines which
have information about what the program is doing. These lines are
called comments and are designated by the // at the beginning of
the line. Any comment that starts with /** and ends with */ is
considered a documentation comment. These are typically written
just before a class header, giving a brief description of the
class. They are also used for documenting methods in the same
way.
⦁ Write a documentation comment at the top of the
program which indicates the purpose of the program, your name, and
today’s date.
⦁ Add comment lines after each variable declaration,
indicating what each variable represents.
⦁ Add comment lines for each section of the program,
indicating what is done in that section.
⦁ Finally add a comment line indicating the purpose of
the calculation.
In: Computer Science