Database Design and SQL
Consider the following relations:
Student (snum: integer, sname: string, major: string, level:
string, age: integer)
Class (name: string, meets_at: time, room: string, fid:
integer)
Enrollment (snum: integer, cname: string)
Faculty (fid: integer, fname: string, deptid: integer)
Write the following queries in SQL. Also, there should be no
duplicates printed in any of the answers.
a) Find the names of all students who are enrolled in two classes
that meet at the same time.
b) Find the names of faculty members for whom the combined
enrollment of the courses that they teach is less than five.
c) Print the Level and the average age of students for that Level,
for each Level.
d) Print the Level and the average age of students for that Level,
for all Levels except JR.
e) Find the names of students who are enrolled in the maximum
number of classes.
f) Find the names of students who are not enrolled in any
class.
In: Computer Science
C Programming
The score table will be printed by reading the match information made between the teams.
It is not known how many teams. The team information will be kept in a dynamically changed memory area as the new team enters. The match list should also be kept in a dynamic area that is recorded as new match information is entered.
There should be 2 structs in the program.
Mac struct: Consists of 1st team name, 2nd team name, 1st team goal, 2nd team goal information.
Team struct: consists of team name (one word, 20), number of wins, number of draws, number of defeats, number of goals scored, number of goals eaten, point.
Example input: abc xyz 3 1 (Information will be entered completely and correctly.)
A single line of match information, with a space between them, 1 Team name, 2 Team name, 1.
The goal scored by the team will be entered as the goal scored by the 2nd team. In the case where the above example is the first match information entered for these teams, two teams will be identified in the abc and xyz names, and will be added to the team list, since there are no teams defined in these names yet. At the same time, a match struct will be defined, this match struct will be added to the match list, and all information of both teams in the team struct will be updated with this match information.
If the above example is not the first match information entered about the abc and xyz teams, since both teams will be defined before, these teams will be found in the teams list and their relevant information will be updated.
In summary, for the above entry, if the team has not yet been identified in these names, both teams will be identified and added to the team list. The number of victories of the ABC team will be increased by one, the number of goals scored will be increased by 3, the number of goals scored will be increased by 1, and the score will be increased by 3. The xyz team's number of defeats will be increased by 1, the goal scored will be increased by 1, the goal it has scored will be increased by 3, its score will be reduced by 1. (wins 3 points, draw 1 point, defeat -1 point). The match struct will be added to the match list.
After entering the match information, the scoreboard will be printed.
Scoreboard: The information in the team struct will be printed one after the other in the order given in the description. The scoreboard should be in descending order according to the score. In case of score equality, the team with a high average score (goals scored and goals scored) should be on the top. It can be assumed that the score and average will not be equal teams.
After the scoreboard is printed, the user will receive a sequence number from 1-teamnumber, and the matches of the team in the row entered will be listed. Unless -1 is entered, the sequence number will be read again after printing the information of a tool, and the program will end when -1 is entered. If a number between 1-teamnumber or an entry other than -1 has been made, an appropriate message will be given and the entry will be waited again.
In: Computer Science
Convert the following switch statement into if-else statements:
int month = input.nextInt();
switch (month) {
case 1: System.out.println(“January”);
case 2: System.out.println(“February”); break;
case 3: System.out.println(“March”); break;
case 4: System.out.println(“April”);
case 5: System.out.println(“May”); break;
default: System.out.println(“Invalid”); break;
}
example:
if (month == 1) {
System.out.println("January");
System.out.println("February"); }
if (month == 2)
{ System.out.println("February");
}
}
}
Please continue the code! Thanks
In: Computer Science
Explain what the following Scheme code is doing:
(define (make-stream n f)
(define (next m)
(cons m (lambda () (next (f m)))))
(next n))
(define head car)
(define (tail stream)
((cdr stream)))
(define (nth stream n)
(if (= n 0) (head stream)
(nth (tail stream) (- n 1))))
(define even (make-stream 0 (lambda (n) (+ n 2))))
Try it out in Scheme48 and check the values of the following expressions:
even (head even) (head (tail even)) (head (tail (tail even))) (head (tail (tail (tail even)))) (nth even 5) (nth even 1000)
Explain what the lambda in make-stream is good for, where this function is called, and how tail and nth work. To see what’s going on, trace manually through the execution of
(head (tail (tail even)))
In: Computer Science
Background: The advantage of wireless signals is that they radiate out in all directions, even penetrating walls to a certain extent. Of course, the very ability of wireless signals also causes problems.
Answer the following questions:
In: Computer Science
IN PSEUDOCODE AND JAVA SOURCE CODE PLEASE:
Program 0 (Warm-up, 40 pts): Deoxyribonucleic acid, or DNA, is comprised of four bases: (G)uanine, (C)ytosine, (A)denine and (T)hymine. Ribonucleic acid, or RNA, is different than DNA in that it contains no Thymine; thymine is replaced with something called (U)racil. For this assignment, you will create an array of 255 characters. You must start by filling the array with random characters of G, C, A and T. You must then print out the array. Next, replace all the instances of Thymine with Uracil. Finally, you must print out the array again. In your solution, you must write at least one function that contributes to the solution. You must use the length attribute of the array in your answer.
Sample run
CATGGCGTCTTGCCAAGGCGGTTCCTTGTCTTGATGATGGCTGCGAGTTCCGAGTCGCCTTTTCTATGAGTCGCGAAGTATGCGGTCAAATTATGCTTGTCCGCTGTACTAGGCCCACGGATCTCCTCAGACAGCGTCGATGTCGGAATTCGCGGGGAGGAATACTAAACATGCTGAAGTTGATACATGTACAATTGCCGCGAACCAGGTGCACAGGGTGCCCAACGATCCATGTGGAACGAGAGCGATCTAGCC
CAUGGCGUCUUGCCAAGGCGGUUCCUUGUCUUGAUGAUGGCUGCGAGUUCCGAGUCGCCUUUUCUAUGAGUCGCGAAGUAUGCGGUCAAAUUAUGCUUGUCCGCUGUACUAGGCCCACGGAUCUCCUCAGACAGCGUCGAUGUCGGAAUUCGCGGGGAGGAAUACUAAACAUGCUGAAGUUGAUACAUGUACAAUUGCCGCGAACCAGGUGCACAGGGUGCCCAACGAUCCAUGUGGAACGAGAGCGAUCUAGCC
In: Computer Science
What are the essential elements of the design side of a systems SAD?
In: Computer Science
Complete a Problem Solving discussion in Word. Your Problem Solving discussion should include Problem Statement, Problem Analysis, Program Design, Program Code and Program Test. For the Program Code section, use Raptor to code
1. Alberta Einstein teaches a business class at Podunk University. To evaluate the students in this class, she has given three tests. It is now the end of the semester and Alberta asks you to create a program that inputs each student’s test scores and outputs the average score for each student and the overall class average. (Hint: The outer loop should allow for Ms. Einstein to input all the students, one by one, and the inner loop should accept the three test scores and compute the average for each student.)
In: Computer Science
ICMP time expired error messages have two meaning? 1.) TTL expired is one reason 2.) what is the other time expired reason? explain fully with an example if possible.
In: Computer Science
C Programming: Write a program that will guess an integer that the user has picked. Imagine that the user will write down a positive integer x on a piece of paper and your program will repeatedly ask questions in order to guess what x is, and the user replies honestly. Your program will start by asking for an int n, and you must have 1 ≤ x ≤ n. After that, the program will successively guess what x is, and the user must tell the computer if x is equal to the guess (entering ’e’), larger than the guess (entering ’l’), or smaller than the guess (entering ’s’). Your program will guess by maintaining a lower bound (initially 1) and upper bound (initially n) and pick the largest integer equal to or smaller than1 the midpoint of the lower bound and upper bound. If the user responds with ’l’ indicating that x is larger, the guess becomes the new lower bound plus one. If the user responds with ’s’ indicating that x is smaller, the guess becomes the new upper bound minus one. If the user responds with ’e’ indicating that x is the guess, your program will report the number of guesses made and terminate execution:
Example 1)
Enter n: 50
Is your number 25? l
Is your number 38? l
Is your number 44? s
Is your number 41? e
Your number must be 41. I used 4 guesses.
Example 2) Enter n: 9
Is your number 5? s
Is your number 2? l
Is your number 3? s
Error: that’s not possible.
Example 3)
Enter n: -2
Error: n must be positive.
Example 4)
Enter n: 9
Is your number 5? m
Error: invalid input.
Example 5) Enter n: a
Error: invalid input.
In: Computer Science
uestion 2
Transform the following “C” program into assembly for
the 6808 Microcontroller.
Remember when converting this “C” code to
follow
best practices
covered in DEF in terms of implementing subroutines in
assembly
o
This means that parameters are passed on the stack to
subroutines
o
Return values are passed back on the stack
o
You clean up the stack after every use (every
subroutine call) to prepare it for the next call
Keep in mind that once your translated this program
into assembly – you can step through it to ensure that it behaves
correctly and calculates the
expected results.
/*
-------------------------------------------------------------
PURPOSE: This program will take 2 operand values
and
calculate the sum and difference of the
values
-------------------------------------------------------------
*/
// This function calculates the sum of 2 operands
called "A" and "B"
Int
calculateSum(
int
A,
int
B)
{
return
(A + B);
}
// This function calculates the difference between 2
operands by negating B and adding it to A
int
calculateDifference(
int
A,
int
B)
{
return
(calculateSum(A, -B));
// reuse the calculateSum function
}
void
main(
void
)
{
int
firstOperand = 18;
// to be stored at address $80 within the
6808
int
secondOperand = 8;
// to be stored at address $81 within the
6808
int
sum = 0;
// to be stored at address $84 within the
6808
int
difference = 0;
// to be stored at address $86 within the
6808
// call the calculateSum function in order to
calculate the total and store it in the "sum" variable
sum = calculateSum(firstOperand,
secondOperand);
// call the calculateDifference function in order to
calculate the difference and store it in the "difference"
}
please help I need the code in assembly
In: Computer Science
In python, how do I define a function (check_domain) which takes a email (string) and domain name (string) as input. using slice, it will return true if the email address' domain same matches the input domain name. For example, when input are ”[email protected]” and ”msn.com”, the function you defined should return True. When input are ”[email protected]” and ”hotmail.com”, it should return False
In: Computer Science
java
Write method that takes a 2D square array and two integer values that represent the indices of the two columns. Method swaps the first two columns.
int[][] in = {{1,2,3}, {3,2,4}, {4,2,7}};
would output 213234247
public static void swap(int[][] in, int index1, int index2) {
In: Computer Science
(For C++) Assume that sentence is a variable of type string that has been assigned a value . Assume furthermore that this value is a string consisting of words separated by single space characters with a period at the end. For example: "This is a possible value of sentence."
Assume that there is another variable declared , secondWord, also of type string . Write the statements needed so that the second word of the value of sentence is assigned to secondWord. So, if the value of sentence were "Broccoli is delicious." your code would assign the value "is" to secondWord.
In: Computer Science
List the relational operators recognized by Python, and explain their meanings
In: Computer Science