Create a view that will display the student id, name, event id, category, and score for all
events for students who scored a 70 or below on any test. Call this view
atriskstudents.
a. What code did you write for this view? Insert the snip of the contents of the view SQL
code here:
b. Using this view, display those students who earned a score of 65 or greater. Insert your
snip here
***********************************************************************************************************************************************************
***********************************************************************************************************************************************************
CREATE DATABASE Class;
#-- Using the database
USE Class;
# create student table
DROP TABLE IF EXISTS student;
CREATE TABLE student
(
name VARCHAR(20) NOT NULL,
gender ENUM('F','M') NOT NULL,
student_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY (student_id)
);
# create grade event table
DROP TABLE IF EXISTS grade_event;
CREATE TABLE grade_event
(
date DATE NOT NULL,
category ENUM('T','Q') NOT NULL,
event_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY (event_id)
);
# create score table
# The PRIMARY KEY comprises two columns to prevent any
combination
# of event_id/student_id from appearing more than once.
DROP TABLE IF EXISTS score;
CREATE TABLE score
(
student_id INT UNSIGNED NOT NULL,
event_id INT UNSIGNED NOT NULL,
score INT NOT NULL,
PRIMARY KEY (event_id, student_id),
INDEX (student_id),
FOREIGN KEY (event_id) REFERENCES grade_event (event_id),
FOREIGN KEY (student_id) REFERENCES student (student_id)
);
# create absence table
DROP TABLE IF EXISTS absence;
CREATE TABLE absence
(
student_id INT UNSIGNED NOT NULL,
date DATE NOT NULL,
PRIMARY KEY (student_id, date),
FOREIGN KEY (student_id) REFERENCES student (student_id)
);
#--Populate the student table
INSERT INTO student VALUES ('Megan','F',NULL);
INSERT INTO student VALUES ('Joseph','M',NULL);
INSERT INTO student VALUES ('Kyle','M',NULL);
INSERT INTO student VALUES ('Katie','F',NULL);
INSERT INTO student VALUES ('Abby','F',NULL);
INSERT INTO student VALUES ('Nathan','M',NULL);
INSERT INTO student VALUES ('Liesl','F',NULL);
INSERT INTO student VALUES ('Ian','M',NULL);
INSERT INTO student VALUES ('Colin','M',NULL);
INSERT INTO student VALUES ('Peter','M',NULL);
INSERT INTO student VALUES ('Michael','M',NULL);
INSERT INTO student VALUES ('Thomas','M',NULL);
INSERT INTO student VALUES ('Devri','F',NULL);
INSERT INTO student VALUES ('Ben','M',NULL);
INSERT INTO student VALUES ('Aubrey','F',NULL);
INSERT INTO student VALUES ('Rebecca','F',NULL);
INSERT INTO student VALUES ('Will','M',NULL);
INSERT INTO student VALUES ('Max','M',NULL);
INSERT INTO student VALUES ('Rianne','F',NULL);
INSERT INTO student VALUES ('Avery','F',NULL);
INSERT INTO student VALUES ('Lauren','F',NULL);
INSERT INTO student VALUES ('Becca','F',NULL);
INSERT INTO student VALUES ('Gregory','M',NULL);
INSERT INTO student VALUES ('Sarah','F',NULL);
INSERT INTO student VALUES ('Robbie','M',NULL);
INSERT INTO student VALUES ('Keaton','M',NULL);
INSERT INTO student VALUES ('Carter','M',NULL);
INSERT INTO student VALUES ('Teddy','M',NULL);
INSERT INTO student VALUES ('Gabrielle','F',NULL);
INSERT INTO student VALUES ('Grace','F',NULL);
INSERT INTO student VALUES ('Emily','F',NULL);
#--Populate grade event table
INSERT INTO grade_event VALUES('2015-09-03', 'Q', NULL);
INSERT INTO grade_event VALUES('
2015-09-06', 'Q', NULL);
INSERT INTO grade_event VALUES('
2015-09-09', 'T', NULL);
INSERT INTO grade_event VALUES('
2015-09-16', 'Q', NULL);
INSERT INTO grade_event VALUES(
'2015-09-23', 'Q', NULL);
INSERT INTO grade_event VALUES('
2015-10-01', 'T', NULL);
#--Populate the score table
INSERT INTO score VALUES (1,1,20);
INSERT INTO score VALUES (3,1,20);
INSERT INTO score VALUES (4,1,18);
INSERT INTO score VALUES (5,1,13);
INSERT INTO score VALUES (6,1,18);
INSERT INTO score VALUES (7,1,14);
INSERT INTO score VALUES (8,1,14);
INSERT INTO score VALUES (9,1,11);
INSERT INTO score VALUES (10,1,19);
INSERT INTO score VALUES (11,1,18);
INSERT INTO score VALUES (12,1,19);
INSERT INTO score VALUES (14,1,11);
INSERT INTO score VALUES (15,1,20);
INSERT INTO score VALUES (16,1,18);
INSERT INTO score VALUES (17,1,9);
INSERT INTO score VALUES (18,1,20);
INSERT INTO score VALUES (19,1,9);
INSERT INTO score VALUES (20,1,9);
INSERT INTO score VALUES (21,1,13);
INSERT INTO score VALUES (22,1,13);
INSERT INTO score VALUES (23,1,16);
INSERT INTO score VALUES (24,1,11);
INSERT INTO score VALUES (25,1,19);
INSERT INTO score VALUES (26,1,10);
INSERT INTO score VALUES (27,1,15);
INSERT INTO score VALUES (28,1,15);
INSERT INTO score VALUES (29,1,19);
INSERT INTO score VALUES (30,1,17);
INSERT INTO score VALUES (31,1,11);
INSERT INTO score VALUES (1,2,17);
INSERT INTO score VALUES (2,2,8);
INSERT INTO score VALUES (3,2,13);
INSERT INTO score VALUES (4,2,13);
INSERT INTO score VALUES (5,2,17);
INSERT INTO score VALUES (6,2,13);
INSERT INTO score VALUES (7,2,17);
INSERT INTO score VALUES (8,2,8);
INSERT INTO score VALUES (9,2,19);
INSERT INTO score VALUES (10,2,18);
INSERT INTO score VALUES (11,2,15);
INSERT INTO score VALUES (12,2,19);
INSERT INTO score VALUES (13,2,18);
INSERT INTO score VALUES (14,2,18);
INSERT INTO score VALUES (15,2,16);
INSERT INTO score VALUES (16,2,9);
INSERT INTO score VALUES (17,2,13);
INSERT INTO score VALUES (18,2,9);
INSERT INTO score VALUES (19,2,11);
INSERT INTO score VALUES (21,2,12);
INSERT INTO score VALUES (22,2,10);
INSERT INTO score VALUES (23,2,17);
INSERT INTO score VALUES (24,2,19);
INSERT INTO score VALUES (25,2,10);
INSERT INTO score VALUES (26,2,18);
INSERT INTO score VALUES (27,2,8);
INSERT INTO score VALUES (28,2,13);
INSERT INTO score VALUES (29,2,16);
INSERT INTO score VALUES (30,2,12);
INSERT INTO score VALUES (31,2,19);
INSERT INTO score VALUES (1,3,88);
INSERT INTO score VALUES (2,3,84);
INSERT INTO score VALUES (3,3,69);
INSERT INTO score VALUES (4,3,71);
INSERT INTO score VALUES (5,3,97);
INSERT INTO score VALUES (6,3,83);
INSERT INTO score VALUES (7,3,88);
INSERT INTO score VALUES (8,3,75);
INSERT INTO score VALUES (9,3,83);
INSERT INTO score VALUES (10,3,72);
INSERT INTO score VALUES (11,3,74);
INSERT INTO score VALUES (12,3,77);
INSERT INTO score VALUES (13,3,67);
INSERT INTO score VALUES (14,3,68);
INSERT INTO score VALUES (15,3,75);
INSERT INTO score VALUES (16,3,60);
INSERT INTO score VALUES (17,3,79);
INSERT INTO score VALUES (18,3,96);
INSERT INTO score VALUES (19,3,79);
INSERT INTO score VALUES (20,3,76);
INSERT INTO score VALUES (21,3,91);
INSERT INTO score VALUES (22,3,81);
INSERT INTO score VALUES (23,3,81);
INSERT INTO score VALUES (24,3,62);
INSERT INTO score VALUES (25,3,79);
INSERT INTO score VALUES (26,3,86);
INSERT INTO score VALUES (27,3,90);
INSERT INTO score VALUES (28,3,68);
INSERT INTO score VALUES (29,3,66);
INSERT INTO score VALUES (30,3,79);
INSERT INTO score VALUES (31,3,81);
INSERT INTO score VALUES (2,4,7);
INSERT INTO score VALUES (3,4,17);
INSERT INTO score VALUES (4,4,16);
INSERT INTO score VALUES (5,4,20);
INSERT INTO score VALUES (6,4,9);
INSERT INTO score VALUES (7,4,19);
INSERT INTO score VALUES (8,4,12);
INSERT INTO score VALUES (9,4,17);
INSERT INTO score VALUES (10,4,12);
INSERT INTO score VALUES (11,4,16);
INSERT INTO score VALUES (12,4,13);
INSERT INTO score VALUES (13,4,8);
INSERT INTO score VALUES (14,4,11);
INSERT INTO score VALUES (15,4,9);
INSERT INTO score VALUES (16,4,20);
INSERT INTO score VALUES (18,4,11);
INSERT INTO score VALUES (19,4,15);
INSERT INTO score VALUES (20,4,17);
INSERT INTO score VALUES (21,4,13);
INSERT INTO score VALUES (22,4,20);
INSERT INTO score VALUES (23,4,13);
INSERT INTO score VALUES (24,4,12);
INSERT INTO score VALUES (25,4,10);
INSERT INTO score VALUES (26,4,15);
INSERT INTO score VALUES (28,4,17);
INSERT INTO score VALUES (30,4,11);
INSERT INTO score VALUES (31,4,19);
INSERT INTO score VALUES (1,5,15);
INSERT INTO score VALUES (2,5,12);
INSERT INTO score VALUES (3,5,11);
INSERT INTO score VALUES (5,5,13);
INSERT INTO score VALUES (6,5,18);
INSERT INTO score VALUES (7,5,14);
INSERT INTO score VALUES (8,5,18);
INSERT INTO score VALUES (9,5,13);
INSERT INTO score VALUES (10,5,14);
INSERT INTO score VALUES (11,5,18);
INSERT INTO score VALUES (12,5,8);
INSERT INTO score VALUES (13,5,8);
INSERT INTO score VALUES (14,5,16);
INSERT INTO score VALUES (15,5,13);
INSERT INTO score VALUES (16,5,15);
INSERT INTO score VALUES (17,5,11);
INSERT INTO score VALUES (18,5,18);
INSERT INTO score VALUES (19,5,18);
INSERT INTO score VALUES (20,5,14);
INSERT INTO score VALUES (21,5,17);
INSERT INTO score VALUES (22,5,17);
INSERT INTO score VALUES (23,5,15);
INSERT INTO score VALUES (25,5,14);
INSERT INTO score VALUES (26,5,8);
INSERT INTO score VALUES (28,5,20);
INSERT INTO score VALUES (29,5,16);
INSERT INTO score VALUES (31,5,9);
INSERT INTO score VALUES (1,6,100);
INSERT INTO score VALUES (2,6,91);
INSERT INTO score VALUES (3,6,94);
INSERT INTO score VALUES (4,6,74);
INSERT INTO score VALUES (5,6,97);
INSERT INTO score VALUES (6,6,89);
INSERT INTO score VALUES (7,6,76);
INSERT INTO score VALUES (8,6,65);
INSERT INTO score VALUES (9,6,73);
INSERT INTO score VALUES (10,6,63);
INSERT INTO score VALUES (11,6,98);
INSERT INTO score VALUES (12,6,75);
INSERT INTO score VALUES (14,6,77);
INSERT INTO score VALUES (15,6,62);
INSERT INTO score VALUES (16,6,98);
INSERT INTO score VALUES (17,6,94);
INSERT INTO score VALUES (18,6,94);
INSERT INTO score VALUES (19,6,74);
INSERT INTO score VALUES (20,6,62);
INSERT INTO score VALUES (21,6,73);
INSERT INTO score VALUES (22,6,95);
INSERT INTO score VALUES (24,6,68);
INSERT INTO score VALUES (25,6,85);
INSERT INTO score VALUES (26,6,91);
INSERT INTO score VALUES (27,6,70);
INSERT INTO score VALUES (28,6,77);
INSERT INTO score VALUES (29,6,66);
INSERT INTO score VALUES (30,6,68);
INSERT INTO score VALUES (31,6,76);
#--Populate the absence table
INSERT INTO `absence` VALUES (3,'2015-09-03');
INSERT INTO `absence` VALUES (5,'2015-09-03');
INSERT INTO `absence` VALUES (10,'2015-09-06');
INSERT INTO `absence` VALUES (10,'2015-09-09');
INSERT INTO `absence` VALUES (17,'2015-09-07');
INSERT INTO `absence` VALUES (20,'2015-09-07');
***********************************************************************************************************************************************************
***********************************************************************************************************************************************************
In: Computer Science
Research the development of input and output devices in computers
In: Computer Science
Create a generic function max() in C++, to find maximum of 3 generic type arguments, then test this function with char, int and float type.
In: Computer Science
Use Python to write the following code.
Program Specifications:
You are to design the following menu:
G] Get a number
S] Display current sum
A] Display current average
H] Display the current highest number
L] Display the current lowest number
D] Display all numbers entered
Q] Quit
If the user enters G, S, A, H, L, or D before selecting G the program needs to advise the user to go and enter a number first.
Rules for the Programmer (you)
In: Computer Science
What are templates in c++? How are they made? Write a program to explain function template.
In: Computer Science
Problem 2
Write a function (call it by your first name e.g. abc_trim) that takes a list as argument , modifies it by removing the first and last two elements, and returns the new modified list e.g. if we call the function as katline_trim([1,4,6,8,11, 15]), we should get [4,6,8]. (Hint: Look at how we refer to list elements by their index and also how we use a negative number as index. You can also use a loop with the len() method
NB: Include python code, please. use spider
In: Computer Science
The Web has grown exponentially since its early days. Why?
Please write at least 150 words.
In: Computer Science
In the assignment below please fix the errors in each
code. The first code should have a total of 3 erros. The second and
third code should have 4 errors. Thanks
//DEBUG05-01
// This program is supposed to display every fifth year
// starting with 2017; that is, 2017, 2022, 2027, 2032,
// and so on, for 30 years.
// There are 3 errors you should find.
start
Declarations
num year
num START_YEAR = 2017
num FACTOR = 5
num END_YEAR = 30
year = START_YEAR
while year <= END_YEAR
output year
endif
stop
//DEBUG05-02
// A standard mortgage is paid monthly over 30 years.
// This program is intended to output 360 payment coupons
// for each new borrower at a mortgage company.
// Each coupon lists the month number, year number,
// and a friendly mailing reminder.
// There are 4 errors here.
start
Declarations
num MONTHS = 12
num YEARS = 30
string MSG = "Remember to allow 5
days for mailing"
num acctNum
num yearCounter
housekeeping()
while acctNUm <> QUIT
printCoupons()
endwhile
finish()
stop
housekeeping()
print "Enter account number or ", QUIT, " to quit
"
input acctNum
return
printCoupons()
while yearCounter <= YEARS
while monthCounter <=
MONTHS
print acctNum,
monthCounter, yearCounter, MSG
monthCounter =
monthCounter + 1
endwhile
endwhile
output "Enter account number or ", QUIT, " to quit
"
input acctNum
return
finish()
output "End of job"
return
//DEBUG05-03
// This program displays every combination of three-digits
// There are 4 errors here.
start
Declarations
num digit1 = 0
num digit2 = 0
num digit3 = 0
while digit1 <= 9
while digit2 <= 9
while digit3 <=
9
output digit1, digit2, digit3
digit1 = digit1 + 1
endwhile
digit2 = digit2 +
1
endwhile
digit3 = digit3 + 1
endwhile
stop
In: Computer Science
Write a JAVA program in eclipse (write comment in every line) that asks the user to enter two numbers and an operator (+, -, *, / or %), obtain them from the user and prints their sum, product, difference, quotient or remainder depending on the operator. You need to use OOP techniques (objects, classes, methods….). This program must be place in a loop that runs 3 times.
In: Computer Science
How can I get the days to print in order (Monday, Tuesday, Wednesday etc)
def summarize_by_weekday(expense_list):
"""
Requirement 3 to display the total amount of money spent on each
weekday, aggregated per day.
That is, display “Monday: $35”, “Tuesday: $54”, etc., where $35 is
the sum of dollar amounts for a
ll Mondays present in the data file, $54 is the sum of dollar
amounts for all Tuesdays present in the data file,
and so on.
:param expense_list:
:return: None
"""
weekday_spent_dict={}
for expense in expense_list:
if weekday_spent_dict.get(expense[0])==None:
weekday_spent_dict[expense[0]]=expense[1]
else:
weekday_spent_dict[expense[0]] += expense[1]
for day in sorted(weekday_spent_dict.keys()):
print('{0}: ${1:5.2f}'.format(day,weekday_spent_dict.get(day)))
output is:
Enter 1 display all of the expense records
2 to display all of the expense records for a particular
category
3 to display the total amount of money spent on each weekday,
aggregated per day
0 to quit.3
Friday: $94.90
Monday: $40.75
Saturday: $201.38
Sunday: $305.44
Thursday: $276.49
Tuesday: $14.85
Wednesday: $14.85
I want it to print:
Monday
Tuesday
Wednesday
etc..
def get_data(fname):
fileObj = open(fname)
lines = fileObj.readlines()
expense_list = []
for line in lines[1:]: # for lines starting at 2 (excluding 1
because it is the
line_items = line.strip().split(",") # strip removes the newline
character
expense_list.append([line_items[0], float(line_items[1]),
line_items[2]])
return expense_list
In: Computer Science
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main {
static Scanner sc=new Scanner(System.in);
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException {
// TODO code application logic here
System.out.print("Enter any String: ");
String str = br.readLine();
System.out.print("\nEnter the Key: ");
int key = sc.nextInt();
String encrypted = encrypt(str, key);
System.out.println("\nEncrypted String is: " +encrypted);
String decrypted = decrypt(encrypted, key);
System.out.println("\nDecrypted String is: "
+decrypted); System.out.println("\n");
}
public static String encrypt(String str, int key)
{ String encrypted = "";
for(int i = 0; i < str.length(); i++) {
int c = str.charAt(i);
if (Character.isUpperCase(c)) {
c = c + (key % 26);
if (c > 'Z')
c = c - 26;
}
else if (Character.isLowerCase(c)) {
c = c + (key % 26);
if (c > 'z')
c = c - 26;
}
encrypted += (char) c;
}
return encrypted;
}
public static String decrypt(String str, int key)
{ String decrypted = "";
for(int i = 0; i < str.length(); i++) {
int c = str.charAt(i);
if (Character.isUpperCase(c)) {
c = c - (key % 26);
if (c < 'A')
c = c + 26;
}
else if (Character.isLowerCase(c)) {
c = c - (key % 26);
if (c < 'a')
c = c + 26;
}
decrypted += (char) c;
}
return decrypted;
}
}
What is the Caesar cipher?
Write the algorithm of the illustrated program?
In: Computer Science
C++ Question
Write a code for :-
public List Palindrome();
//Check whether a given singly linked list is palindrome or not.
Input:
a -> b-> NULL
a -> b -> a-> NULL
s -> a -> g -> a -> r-> NULL r -> a -> d -> a -> r-> NULL
Output:
not palindrome palindrome
not palindrome palindrome
Note:- Code should work on MS-Visual Studio 2017 and provide outputs with code
In: Computer Science
IMPLEMENT IN JAVA PLEASE I NEED THIS DONE ASAP
Question 1 (25pt) Dynamic Programming – Coin Change
Design algorithm for the coin change problem using dynamic programming approach. Given coin denominations by value: c1 < c2 < … < cn, and change amount of x, find out how to pay amount x to customer using fewest number of coins.
Your algorithm needs to work for ANY coin denomination c1 < c2 < … < cn, and ANY change amount of x. For example, given coin denominations 1, 5, 10, 25, x=78, the solution is {3 coins of 25 and 3 coins of 1, total 6 coins}.
NEED TO DO ALL 3 PARTS
• Present your algorithm in pseudo code.
• Trace your algorithm and show how it works on a small example, show the step-by-step process and the final result.
• Analyze the time complexity of the algorithm and present the result using order notation.
In: Computer Science
Hide Assignment Information |
|
Instructions | |
In this assignment, you will be practicing the Java OOP skills we've learned this week in implementing a customized mutable Array class. Please read the following requirements carefully and then implement your own customized Array class: === 1) Basic (100' pts total) === Your Array class must provide the following features: --1.1) (20' pts) Two constructors. One takes the input of the initialized capacity (int) and create the underlying array with that capacity; the other takes no input and creates an array that can hold a single element by default (that is, init capacity == 1); --1.2) (20' pts) Getters and setters and basic methods we discussed during the class including: getCapacity(), getSize(), set(int index), get(int index), isEmpty(); --1.3) (20' pts) CRUD operations we discussed during the class including: add(int index), addLast(), addFirst(), remove(int index), removeLast(), removeFirst(), removeElement(int target), removeAll(int target); --1.4) (20' pts) Supports generic types; --1.5) (20' pts) Mutable, that is when add element exceeding its capacity, it can resize to accommodate the change. === 2) Bonus (20' pts total) === 2.1) (10' pts) Implement a (private or public) swap(int a, int b) method that swaps the two elements in the index a and b if a and b are both admissible; also a public reverse() method that reverses the order of stored elements in-place (means, no additional spaces are allocated). 2.2) (10' pts) A public void sort() method sorts the stored elements in ascending order inO(nlog(n)) time. [hint]: Quicksort or Merge sort |
In: Computer Science
Multidimensional Arrays
Design a C program which uses two two-dimensional arrays as
follows:
- an array which can store up to 50 student names where a name is
up to 25 characters long
- an array which can store marks for 5 courses for up to 50
students
The program should first obtain student names and their
corresponding marks for a requested number of students from the
user. Please note that the program should reject any number of
students that is requested by the user which is greater than 50.
The program will compute the average mark for each course and then
display all students and their marks, as well as the average mark
for each course.
A sample output produced by the program is shown below, if assumed
that the user entered marks for 4 students. Please note that the
computation of the average mark for each course should use type
casting.
Student PRG DGS MTH ECR GED
Ann Smart 93 85 87 83 90
Mike Lazy 65 57 61 58 68
Yo Yo 78 65 69 72 75
Ma Ma 84 79 83 81 83
AVERAGE 80.0 71.5 75.0 73.5 79.0
It is required to submit your source code file, i.e. Lab5.c file as
well as a file with your program's run screen captures.
In: Computer Science