In: Computer Science
In system/ asset classification, what would be the actual risk associated with compromise of different system types? Would you allocate protection/detection resources differently based on categorization?
In: Computer Science
Customer Transaction Table – CUSTOMER_TXNS
Column Name |
Description |
Type |
Account_id |
Account identifier |
Integer |
Txn_timestamp |
Time of transaction (UTC) |
Timestamp |
Product_id |
The id of the product purchased |
Integer |
Txn_Amt |
The revenue amount of the transaction |
Float |
Txn_Qty |
The number of items purchased |
Integer |
NOTE: Customer Transaction table has multiple records per account_id.
Customer Master Table – CUSTOMER_MSTR
Column Name |
Description |
Type |
Account_id |
Account identifier |
Integer |
Country |
Country Code |
Character(3) |
Address |
Address of the customer |
Character(64) |
Registerd_Dt |
Date the account id was first used |
Date |
Tier |
Account Tier |
Integer |
NOTE: Customer Master table has one record per account_id.
Table CUSTOMER_MSTR has 100 records and table CUSTOMER_TXNS has 500 records. What is the maximum number of records you can get in a result set if you did the following types of joins? • INNER JOIN on account_id • LEFT JOIN CUSTOMER_MSTR with CUSTOMER_TXNS on account_id • UNION • UNION ALL Feel free to provide a more detailed explanation with assumptions if you wish.
In: Computer Science
def hiCount(iterable): rtnVal = 0 most = '' for item in iterable: num = iterable.count(item) if num > rtnVal: most = item rtnVal = num return tuple(most, rtnVal) lyric = "you don't own me" print(hiCount(lyric))
does all the for then the return
Python
In: Computer Science
Question 2. The following tables provide some example data that will be kept in the database. Write the INSERT commands necessary to place the following data in the tables that were created in Question 1. Alternatively provide the text files (copy and pasted into your final report) and the open/insert from file commands..
Table: actor
act_id | act_fname | act_lname | act_gender
101 | James | Stewart | M
102 | Deborah | Kerr | F
103 | Peter | OToole | M
104 | Robert | De Niro | M
105 | F. Murray | Abraham | M
106 | Harrison | Ford | M
107 | Nicole | Kidman | F
108 | Stephen | Baldwin | M
109 | Jack | Nicholson | M
110 | Mark | Wahlberg | M
111 | Woody | Allen | M
112 | Claire | Danes | F
113 | Tim | Robbins | M
114 | Kevin | Spacey | M
115 | Kate | Winslet | F
116 | Robin | Williams | M
117 | Jon | Voight | M
118 | Ewan | McGregor | M
119 | Christian | Bale | M
120 | Maggie | Gyllenhaal | F
121 | Dev | Patel | M
122 | Sigourney | Weaver | F
123 | David | Aston | M
124 | Ali | Astin | F
Table: movie_cast
act_id | mov_id | role
101 | 901 | John Scottie Ferguson
102 | 902 | Miss Giddens
103 | 903 | T.E. Lawrence
104 | 904 | Michael
105 | 905 | Antonio Salieri
106 | 906 | Rick Deckard
107 | 907 | Alice Harford
108 | 908 | McManus
110 | 910 | Eddie Adams
111 | 911 | Alvy Singer
112 | 912 | San
113 | 913 | Andy Dufresne
114 | 914 | Lester Burnham
115 | 915 | Rose DeWitt Bukater
116 | 916 | Sean Maguire
117 | 917 | Ed
118 | 918 | Renton
120 | 920 | Elizabeth Darko
121 | 921 | Older Jamal
122 | 922 | Ripley
114 | 923 | Bobby Darin
109 | 909 | J.J. Gittes
119 | 919 | Alfred Borden
Table: movie
mov_id | mov_title | mov_year | mov_time | mov_lang | mov_dt_rel | mov_rel_country
901 | Vertigo | 1958 | 128 | English | 1958-08-24 | UK
902 | The Innocents | 1961 | 100 | English | 1962-02-19 | SW
903 | Lawrence of Arabia | 1962 | 216 | English | 1962-12-11 | UK
904 | The Deer Hunter | 1978 | 183 | English | 1979-03-08 | UK
905 | Amadeus | 1984 | 160 | English | 1985-01-07 | UK
906 | Blade Runner | 1982 | 117 | English | 1982-09-09 | UK
907 | Eyes Wide Shut | 1999 | 159 | English | | UK
908 | The Usual Suspects | 1995 | 106 | English | 1995-08-25 | UK
909 | Chinatown | 1974 | 130 | English | 1974-08-09 | UK
910 | Boogie Nights | 1997 | 155 | English | 1998-02-16 | UK
911 | Annie Hall | 1977 | 93 | English | 1977-04-20 | USA
912 | Princess Mononoke | 1997 | 134 | Japanese | 2001-10-19 | UK
913 | The Shawshank Redemption | 1994 | 142 | English | 1995-02-17 | UK
914 | American Beauty | 1999 | 122 | English | | UK
915 | Titanic | 1997 | 194 | English | 1998-01-23 | UK
916 | Good Will Hunting | 1997 | 126 | English | 1998-06-03 | UK
917 | Deliverance | 1972 | 109 | English | 1982-10-05 | UK
918 | Trainspotting | 1996 | 94 | English | 1996-02-23 | UK
919 | The Prestige | 2006 | 130 | English | 2006-11-10 | UK
920 | Donnie Darko | 2001 | 113 | English | | UK
921 | Slumdog Millionaire | 2008 | 120 | English | 2009-01-09 | UK
922 | Aliens | 1986 | 137 | English | 1986-08-29 | UK
923 | Beyond the Sea | 2004 | 118 | English | 2004-11-26 | UK
924 | Avatar | 2009 | 162 | English | 2009-12-17 | UK
926 | Seven Samurai | 1954 | 207 | Japanese | 1954-04-26 | JP
927 | Spirited Away | 2001 | 125 | Japanese | 2003-09-12 | UK
928 | Back to the Future | 1985 | 116 | English | 1985-12-04 | UK
925 | Braveheart | 1995 | 178 | English | 1995-09-08 | UK
Table: director
dir_id | dir_fname | dir_lname
201 | Fred | Caravanhitch
202 | Jackie | Claytonburry
203 | Greene | Lyon
204 | Miguel | Camino
205 | George | Forman
206 | Antartic | Scott
207 | Stanlee | Carbrick
208 | Bryon | Sanger
209 | Roman | Polanski
210 | Paul | Thomas Anderson
211 | Woody | Allen
212 | Hayao | Miyazaki
213 | Frank | Darabont
214 | Sam | Mendes
215 | James | Cameron
216 | Gus | Van Sant
217 | John | Boorman
218 | Danny | Boyle
219 | Christopher | Nolan
220 | Richard | Kelly
221 | Kevin | Spacey
222 | Andrei | Tarkovsky
223 | Peter | Jackson
Table: movie_direction
dir_id | mov_id
201 | 901
202 | 902
203 | 903
204 | 904
205 | 905
206 | 906
207 | 907
208 | 908
209 | 909
210 | 910
211 | 911
212 | 912
213 | 913
214 | 914
215 | 915
216 | 916
217 | 917
218 | 918
219 | 919
220 | 920
218 | 921
215 | 922
221 | 923
Table: genres
gen_id | gen_title
1001 | Action
1002 | Adventure
1003 | Animation
1004 | Biography
1005 | Comedy
1006 | Crime
1007 | Drama
1008 | Horror
1009 | Music
1010 | Mystery
1011 | Romance
1012 | Thriller
1013 | War
Table: movie_genres
mov_id | gen_id
922 | 1001
917 | 1002
903 | 1002
912 | 1003
911 | 1005
908 | 1006
913 | 1006
926 | 1007
928 | 1007
918 | 1007
921 | 1007
902 | 1008
923 | 1009
907 | 1010
927 | 1010
901 | 1010
914 | 1011
906 | 1012
904 | 1013
Table: rating
mov_id | rev_id | rev_stars | num_o_ratings
901 | 9001 | 8.40 | 263575
902 | 9002 | 7.90 | 20207
903 | 9003 | 8.30 | 202778
906 | 9005 | 8.20 | 484746
924 | 9006 | 7.30 |
908 | 9007 | 8.60 | 779489
909 | 9008 | | 227235
910 | 9009 | 3.00 | 195961
911 | 9010 | 8.10 | 203875
912 | 9011 | 8.40 |
914 | 9013 | 7.00 | 862618
915 | 9001 | 7.70 | 830095
916 | 9014 | 4.00 | 642132
925 | 9015 | 7.70 | 81328
918 | 9016 | | 580301
920 | 9017 | 8.10 | 609451
921 | 9018 | 8.00 | 667758
922 | 9019 | 8.40 | 511613
923 | 9020 | 6.70 | 13091
Table: reviewer
rev_id | rev_name
9001 | Righty Sock
9002 | Jack Malvern
9003 | Flagrant Baronessa
9004 | Alec Shaw
9005 |
9006 | Victor Woeltjen
9007 | Simon Wright
9008 | Neal Wruck
9009 | Paul Monks
9010 | Mike Salvati
9011 |
9012 | Wesley S. Walker
9013 | Sasha Goldshtein
9014 | Josh Cates
9015 | Krug Stillo
9016 | Scott LeBrun
9017 | Hannah Steele
9018 | Vincent Cadena
9019 | Brandt Sponseller
9020 | Richard Adams
In: Computer Science
Can you please see what I have done wrong with my program code and explain, This python program is a guess my number program. I can not figure out what I have done wrong. When you enter a letter into the program, its supposed to say "Numbers Only" as a response. I can not seem to figure it out.. instead of an error message.
import random
def menu():
print("\n\n1. You guess the number\n2. You type a number and see if
the computer can guess it\n3. Exit")
while True:
c=int(input("Enter your choice: "))
if(c>=1 and c<=3):
return c
else:
print("Enter number between 1 and 3 inclusive.")
def guessingGame():
min_number=1
max_number=10
#set number of guesses = 0
numGuesses=0
rand=random.randint(min_number, max_number)
#prints the header, welcoming the user
print("\nWelcome to the Guess My Number Program!")
#While loop, comparing the users guessed number with the random
number.
#If it matches, it will say you guessed it.
while (True):
#use try-block
try:
guess=eval(input("Please try to guess my number between 1 and
10:"))
#check if the guess is less than 0, then continye to beginning of
the loop
if(guess<0):
continue;
elif (guess==rand):
#increment the guess count by 1
numGuesses=numGuesses+1
print("You guessed it! It took you ", numGuesses,"attempts")
#break will end the loop once the guess is a match.
#Conditions if the guess is too low or too high to keep
guessing
break
elif(guess < rand):
#increment the guess count by 1
numGuesses = numGuesses +1
print("Too low")
else:
#increment the guess count by 1
numGuesses = numGuesses + 1
print("Too high")
except:
#print exception
print("Numbers only!")
def guessingGameComp():
countGuess=0
userNumber=int(input("\nPlease enter a number between 1 and 10 for
the computer to guess:"))
while userNumber<1 or userNumber>10:
userNumber=int(input("Guess a number between 1 and 10: "))
while True:
countGuess+=1
compRand = random.randint(1,10)
if(userNumber==compRand):
print("The computer guessed it! It took {}
attempts".format(countGuess))
break
elif(userNumber<compRand):
print("The computer guessed {} which is too
low".format(compRand))
else:
print("The computer guessed {} which is too
high".format(compRand))
def main():
while True:
userChoice=menu()
if userChoice==1:
guessingGame()
elif userChoice==2:
guessingGameComp()
elif userChoice==3:
print("\nThank you for playing the guess the number game!")
break
else:
print("Invalid choice!!!")
main()
In: Computer Science
Imagine you have a spare desktop machine with an Intel Pentium IV 2.8 GHz (32-bit) CPU, 2 GB RAM memory and 512 GB storage memory. This machine is connected to the internet using your home internet router. You would like to use this machine to host:
How you would proceed to select and configure these servers? Your discussion must cover the following points:
Write no more than 400 words for this question.
In: Computer Science
In: Computer Science
JAVA
Please put detailed comments as well explaining your program.
I'm in a beginning programming class, and so please use more basic techniques such as if else statements, switch operators, and for loops if needed.
http://imgur.com/a/xx9Yc
Pseudocode for the main method:
Print the headings
Print the directions
Prompt for the month
If the month is an integer (Hint: Use the Scanner class hasNextInt method.)
Input the integer for the month
Get the string for the month (Use your method)
Otherwise
Input the string for the month
Get the integer for the month (Use your method)
Prompt for the day
Input the day
Prompt for the year
Input the year
Get the holiday
Print the output
THE PROBLEM:
You must use switch statements for some part of the homework.
Write a program that inputs a month, day, and year from the user and outputs the corresponding date in the following two standard date formats:
6/12/2005 June 12, 2005
Also your program must print the name of any holiday associated with the date.
For example:
3/17/2010 March 17, 2010 St. Patrick’s Day
Your program should ask the user how many times the user wants to run the code and then you need to use a for loop to repeat the run that many times.
REQUIREMENTS:
You must use good programming style.
The user can enter the month either as a numeric value or a String. i.e. the user could enter a 5 or May.
You may assume the data that the user enters is valid data.
Your program must print a report similar to that shown in the sample output on the last page of this handout.
You must solve this problem by implementing and using the following methods:
printDirections
void method that prints a message to the user that explains what the program will do and how the month data can be entered. (See the sample output above.)
getMonthString
method that has 1 parameter, the month as an integer (1..12).
This method returns the corresponding name of the month as a String.
getMonthNumber
method that has 1 parameter, the name of the month in a String.
This method returns the corresponding integer value for that month name.
HINT: Before you read the data for the month, use the Scanner class hasNextInt method to determine what kind of data the user entered for the month. Using hasNextInt you can determine if the user is entering an integer for the month or not.
getHoliday
This method has 2 int type parameters for month and day.
The method returns a String that is the name of a holiday that is associated with the date represented by the parameters. If there is no holiday associated with that date, then the method returns an empty String (“”).
Use nested switch statements to implement this method. Use one switch statement for the months. Inside the case for each month, use a switch statement that has a case for each day in that month that is a holiday. Inside each of those day cases, set the holiday string to the name of the holiday.
NOTE: You can also include holidays for your birthday, anniversary, or whatever …
isEaster
This method has 3 int type parameters for month, day and year.
This method returns true if the date represented by the 3 parameters is Easter, otherwise it returns false.
To implement this method: use the following formula to figure out the month and the day of easter for the given year.
goldenNumber = (year % 19) + 1;
a = (24 + 19*(goldenNumber - 1)) % 30; b = a - a/28;
c = (year + year/4 + b - 13) % 7; d = b - c;
easterMonth = 3 + (d + 40)/44;
easterDay = d + 28 - 31*(easterMonth/4);
To use this method, you will have to add a third parameter to the getHoliday method for the year, and then inside the getHoliday method, after the switch statements, call this method.
NOTE: If the holiday string is already longer than 0, this day is already associated with another holiday,
(For example, maybe “Grandma’s Birthday”, then getHoliday should return “Easter and Grandma’s Birthday”.
To test the isEaster method, make April 4 “Grandma’s Birthday” and test this method using 4/4/2010. Also test it for Easter in a year where Easter is not on April 4.
Here is a list of holidays that your need needs to generate the appropriate output:
1/1 "New Year's Day";
1/18 "Martin Luther King Jr. Day";
2/2 "Ground Hog Day";
2/12 "Abraham Lincoln's Birthday";
2/14 "St. Valeninte's Day";
2/22 "George Washington's Birthday";
3/17 "St. Patrick's Day"; 4/1 "April Fool's Day";
4/4 "Grandma's Birthday";
4/22 "Earth Day";
4/30 "Arbor Day";
5/1 "May Day";
5/5 "Cinco de Mayo";
7/4 "Independence Day";
8/1 "International Friendship Day";
10/1 "Columbus Day";
10/31 "Halloween";
11/11 "Vereran's Day";
12/25 "Christmas";
12/31 "New Year's Eve";
?? "Easter";
Sample outputs
CSC 15 – Chapter 4 – [Your Name] This program will ask you for a month, day, and year and will print the corresponding date in two standard date formats. You may enter the month as: * a numeric value (1..12) or as * an unabbreviated month name (January or February etc....) How many times do you want to run the program: 3 Enter the month: 10 Enter the day: 31 Enter the year: 2010 The Date is: 10/31/2010 October 31, 2010 Halloween Enter the month: 1 Enter the day: 1 Enter the year: 2014 The Date is: 1/1/2014 January 1, 2014 New Year's Day Enter the month: 4 Enter the day: 4 Enter the year: 2010 The Date is: 4/4/2010 April 4, 2010 Easter and Grandma's Birthday |
Pseudocode for the main method:
Print the headings
Print the directions
Prompt for the month
If the month is an integer (Hint: Use the Scanner class hasNextInt method.)
Input the integer for the month
Get the string for the month (Use your method)
Otherwise
Input the string for the month
Get the integer for the month (Use your method)
Prompt for the day
Input the day
Prompt for the year
Input the year
Get the holiday
Print the output
In: Computer Science
In: Computer Science
During system/ asset classification, should we think about risk first or categorizing? What process should be followed to categorize the systems?
In: Computer Science
The input is broken into chunks of consecutive lines, where each pair of consecutive chunks is separated by a line containing "----snip----". Read the entire input and break it into chunks C1,…,Ck. Then output the chunks in reverse order Ck,…,C1 but preserving the order of the lines within each chunk. import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Part7 { /** * Your code goes here - see Part0 for an example * @param r the reader to read from * @param w the writer to write to * @throws IOException */ public static void doIt(BufferedReader r, PrintWriter w) throws IOException { // Your code goes here - see Part0 for an example } /** * The driver. Open a BufferedReader and a PrintWriter, either from System.in * and System.out or from filenames specified on the command line, then call doIt. * @param args */ public static void main(String[] args) { try { BufferedReader r; PrintWriter w; if (args.length == 0) { r = new BufferedReader(new InputStreamReader(System.in)); w = new PrintWriter(System.out); } else if (args.length == 1) { r = new BufferedReader(new FileReader(args[0])); w = new PrintWriter(System.out); } else { r = new BufferedReader(new FileReader(args[0])); w = new PrintWriter(new FileWriter(args[1])); } long start = System.nanoTime(); doIt(r, w); w.flush(); long stop = System.nanoTime(); System.out.println("Execution time: " + 1e-9 * (stop-start)); } catch (IOException e) { System.err.println(e); System.exit(-1); } } }
In: Computer Science
Case Study: University Library System
This case is a simplified (initial draft) of a new system for the
University Library. Of course, the library system must keep track
of books. Information is maintained about both book titles and the
individual book copies. Book titles maintain information about
title, author, publisher, and catalog number. Individual copies
maintain copy number, edition, publication year, ISBN, book status
(whether it is on the shelf or loaned out), and date due back
in.
The library also keeps track of patrons to the library. Since it is
a university library, there are several types of patrons, each with
different privileges. There are faculty patrons, graduate student
patrons, and undergraduate student patrons. Basic information about
all patrons is name, address, and telephone number. For faculty
patrons, additional information is office address and telephone
number. For graduate students, information such as graduate program
and advisor information is maintained. For undergraduate student’s
program and total credit hours are maintained.
The library also keeps information about library loans. A library
loan is a somewhat abstract object. A loan occurs when a patron
approaches the circulation desk with a stack of books to check out.
Over time a patron can have many loans. A loan can have many
physical books associated with it. (And a physical book can be on
many loans over a period of time. Information about past loans is
kept in the database.) So, in this case, it is recommended that an
association class be created for loaned books.
If a book is checked out that a patron wants, he/she can put that
title on reserve. This is another class that does not represent a
concrete object. Each reservation is for only one title and one
patron. Information such as date reserved, priority, and date
fulfilled is maintained. When it is fulfilled, the system
associates it with the loan on which it was checked out.
For this case, develop the following diagrams:
1. Use Case description for checking out books with one any exceptional case
In: Computer Science
In: Computer Science
Please design a PLC program to perform the following task:
Post LogixPro image of this programming
Cascading timer
In: Computer Science