Project 1
must contain the following:
ER Diagram.
All schemas before and after normalization.
All SQL statements of:
Creating tables.
Inserting data in tables.
Queries.
Screenshots from MySQL (or any other software you use) of all the
tables after population and queries results. Reservation System
For this project, following assumptions have been made:
The booking is only open for the next seven days from the current date.
Only two categories of the plane can be booked i.e. Economy and Business.
The total number of tickets that can be booked in each category is 10 only.
By ‘user’, we mean the person who is booking the ticket for the passenger(s). For example, an employee of Saudi Airline.
Your project should include information about the following entities and their respective attributes:
Airline Reservation System
User
User_id
User_password
First_name
Last_name
Age
Gender
Email_address
Contact_number
City
Passenger
Passenger_ID
Name
Gender
Age
Phone_num
BookingRef_num
Seat_no
Status
Flight
Flight_number
Flight_name
Departure_airport
Arrival_airport
Departure_time
Arrival_time
Availabilty_of_seats
Airport
Number
Name
Flight_number
Arrival_time
Departure_time
Ticket
Ticket_id
Flight_number
Booked_user
Status
Number_of_passengers
Required SQL Queries:
Write a query that displays the User_id and names of all those passengers who booked ticket on any particular flight.
Write a query to display details (ex. Passenger_ID, name, etc.) of all passengers travelling under a particular ticket.
Write a query to display the time at which any Flight_number reaches any Airport_name. For example, EK233, Dammam.
Write a query to display all flights in ascending order of their departure time.
Write a query to display the flight_number that stops for the longest time at any airport (e.g., Dammam).
In: Computer Science
It’s been said that developing iOS applications represents a step backward for most developers. What does this statement mean? Is it true? Explain your answer.
Thank you in advance
In: Computer Science
Consider the word DOG.
a. What would the hexadecimal representation of this word be in ASCII?
b. What would the binary representation of this word be in ASCII?
c. If we rotated the bits that represent this word 8 bits to the right, what would the word become (in letters)?
d. If we rotated the bits that represent DOG 8 places to the left, what would the word become (in letters)?
e. What would the results be (in letters) if we XORed the bits that represent DOG with the hexadecimal value 20 20 20?
f. What would the results be (in letters) if we XORed the bits that represent DOG with the hexadecimal value 07 0E 13?
In: Computer Science
q1)
Critically analyse the origins of cel animation and the concepts that go into creating these animations. Be sure to include keyframes, tweening, and links?
In: Computer Science
(In C++) Write a program that prompts the user to create a grocery list. A menu provides choices to enter an item and item quantity, to display the list, to search for an item, or to exit the program. The list should maintain a sorted alphabetic order after each addition. Use two parallel vectors to implement this program, one to store the item, and the other to store the number of that item. Modify the sort algorithm of your choice and the binary search algorithm to work with vectors. Remember that when the “names” vector is sorted, you must adjust the “numbers” vector accordingly.
In: Computer Science
Create a stored procedure using the STUDENT database called ap_CalcGrade that does the following: Accepts as input STUDENT_ID, SECTION_ID, GRADE_TYPE_CODE, and GRADE_CODE_OCCURRENCE Outputs the numeric grade and the letter grade back to the user If the numeric grade is found, return 0, otherwise return 1 You muse use a cursor to loop through the GRADE_CONVERSION table to find the letter grade
In: Computer Science
In: Computer Science
Need in C# with the exact style of output listed.
Assignment7A: A new field of computer science: Small Data. Big Data is a really hot area in computing right now and there are tons of jobs in it. Here in FYE, we care more about the field of Small Data, because if you can work with small data, you can extend that to working with big data. For this assignment, you’re going to implement the most common operations on arrays. Specifically, initializing them, printing them, finding the min, finding the max, and finding the sum. These are used all the time, so our recommendation is to understand how to solve the underlying problem and use that as a model for solving harder problems. Write a program that creates an array of 100 integers. I would recommend “pre-initializing” each cell to either 0 or -1 before doing anything else because it will make things easier later. After that, you should write separate (static) functions for initializing the array (from user input - according to the behavior below), printing the array (according to the behavior below – only values that have been entered by the user), finding the minimum element of the array, finding the maximum element of the array, and finding the sum of all elements of the array. Assume that the values the user enters are between 0 – 99. Hint: a very convenient thing would be if your initialization function returned the number of elements the user typed in.
Sample Output #1:
Enter a number or -1 to finish: 6
Enter a number or -1 to finish: 9
Enter a number or -1 to finish: 3
Enter a number or -1 to finish: 1
Enter a number or -1 to finish: 9
Enter a number or -1 to finish: 76
Enter a number or -1 to finish: 42
Enter a number or -1 to finish: 1
Enter a number or -1 to finish: -1
|6|9|3|1|9|76|42|1|
Min is: 1
Max is: 76
Sum is: 147
In: Computer Science
Write a program that accepts an integer as input and then displays all the prime numbers smaller than or equal to that number.
In: Computer Science
Write a program which takes three lists of names, and print out all the names only once. The expected runtime should be O(n) where n is the total number of names in the lists. You don’t have to sort the list. Use appropriate data structure to store the names, so add all data to the collection only once efficiently. The read-in list method and list1, list2, list3 is given. You may assume that the expected runtime of searching or inserting into a hash table is O(1). Do not call the list's contains method, because it slows down the run time.
import java.io.*;
import java.util.*;
public class A4PrintName{
public static List<String> readInFile(String filename){
List<String> input = new ArrayList<>();
try (Scanner sin = new Scanner(new FileReader(filename))){
while (sin.hasNextLine()){
input.add(sin.nextLine());
}
} catch (FileNotFoundException e){
e.printStackTrace();
}
return input;
}
public static void main(String[] args){
List<String> namelist1 = readInFile("A4input1.txt");
List<String> namelist2 = readInFile("A4input2.txt");
List<String> namelist3 = readInFile("A4input3.txt");
Set<String> names;
//your code starts here... you may write any function where you need.
}
}
list 1:
Amy Andy Anna Ben Benjamin Catherine Emma James Jessie Jennifer John Karen Kelly Kyle Lena Liam Mary Mia Steve William
list 2:
Amy Andy Anne Ben Benjamin Catherine David Emma James Jessie Jennifer Jenny John Karen Kelly Kyle Mary Mia Selina Tina William
list 3:
Amy Ana Anne Dave George Selina Shawn William
In: Computer Science
Simple, short explanations, please.
A)Why might it be important to add a separator bar to a submenu item in the menu form? When a program has a lot of items for the user to select from, why should you avoid displaying all of the items on one menu?
B) Discuss the importance of GUI guidelines for menus. give an example of messy menus vs. well-organized menus, and how that affects the user experience.
C) Describe the three steps that must be taken when a data file is used by a program, why should a program close a file when it's finished using it?
D) Today, most information kept by companies is stored in databases. When might it be appropriate to use text files? (small amount of data, data needs randomly accessed?)
In: Computer Science
I got a problem in C struct. I made a aa.txt file and read data by struct. I am learning how to pass variable and value between function by pointers.
The first line in txt (integer 5) means I need to read the next five lines data to struct
aa.txt
5
111
222
333
444
555
*********************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int i,totalRow;
char inBuf[20];
char str[20];
void readData();
void sum() ;
typedef struct demo{
int num;
}demo1;
int main()
{
struct demo demo1;
struct demo *sptr;
sptr= &demo1;
sum(sptr);
return 0;
}
void readData(struct demo *ptr)
{
int i,j;
FILE *fin = NULL;
fin = fopen("aa.txt", "r");
if (fin == NULL)
{
printf("Could not open the file.\n");
}
fgets(str, sizeof(str), fin);
sscanf(str,"%d ",&totalRow);
printf("%d\n",totalRow);
for(i = 0; i {
fgets(str,sizeof(str),fin);
sscanf(str,"%d ", &ptr->num);
printf("%d\n", ptr->num);
}
fclose(fin);
return;
}
//find the sum
void sum(struct demo *ptr)
{
int result;
readData(ptr);
printf("the sum is %d\n", ptr->num);
return;
}
*******************************************************************************
My code of sum function is wrong, I have no idea how to pass the data to sum function from readData function.
readData function can read the data from the file, it works.
Maybe the problem is still in the readData function, because I guess I did not store the data to memory(I am not sure)
Thanks
In: Computer Science
In the RSA cryptosystem, it is possible that M = C, that is, the plaintext and the ciphertext may be identical.
Is this a security concern in practice?
For modulus N = 3127 and encryption exponent e = 17, find at least one non trivial message M (i.e. M > 1) that encrypts to itself
In: Computer Science
Construct a permutation of the ten distinct elements (i.e. the digits 0,1,2,3,4,5,6,7,8,9) that is as bad as possible for quicksort using median-of-three partitioning. Please write out what the permutation is and describe how you found what it is.
In: Computer Science
How many iterations of the for loop does this program perform?
int main(void) {
int a[] = {1, 2, 3, 4};
int i;
for (i = 0; i < 4; i++) {
if (a[i] < 0) return 1;
else return 0;
}
return 0;
}
Question 1 options:
| A |
No iterations. |
| B |
The program crashes. |
| C |
One. |
| D |
The program does not compile. |
| E |
Four. |
Question 2
What does the following program do?
int main(void) {
int i, a[];
a[0]=1;
for (i=0; i<10; i++) {
a[i] = a[i-1] + 2*i + 1;
}
return 0;
}
Question 2 options:
| A |
It crashes when it is run because no memory is reserved for the array. |
| B |
It does not compile. |
| C |
It fills the array with the squares of the integers from 1 to 10. |
| D |
It fills the array with the first 10 powers of 2. |
Question 3
What's the problem with this code?
int main(void) {
int i, a[5];
for (i=1; i <= 5; i++) {
a[i] = i+1;
}
return 0;
}
Question 3 options:
| A |
The main problem is that the loop accesses a non-existing a[5]. This will cause some memory location to be inadvertently written. The secondary problem is that a[0] is left uninitialized. |
| B |
It doesn't compile because one cannot declare an int variable and an int array on the same line. |
| C |
There is no problem. The code will run just fine. |
| D |
It crashes because a[1] is accessed before a[0]. |
Question 4
If a is declared with
int a[10];
what value does sizeof(a) have?
Question 4 options:
| A |
14 |
| B |
Whatever is the size of a pointer to an integer. |
| C |
10 |
| D |
10*sizeof(int) |
Question 5
What does the following program do?
#include
int main(void) {
int a[] = {1,2,3,4};
int b[4]; b = a;
printf("%4d\n", b);
return 0;
}
Question 5 options:
| A |
It prints 1 2 3 4. |
| B |
The program incurs a segmentation fault when run. |
| C |
It does not compile. You cannot copy arrays like that. |
| D |
It does not compile. You cannot print an entire array like that. |
question 6
Arrays are just pointers in disguise.
Question 6 options:
| A | True |
| B | False |
Question 7
Declaring too large an array in a function may cause a stack overflow when the function is called.
Question 7 options:
| A | True |
| B | False |
Question 8
What does the following program do?
int main(void) {
int a[4];
a = {1,2,3,4};
return a[3];
}
Question 8 options:
| A |
It crashes because main can only return 0. |
| B |
It returns 3. |
| C |
It returns 4. |
| D |
It does not compile. |
Question 9
What does the following program do?
#include
int main(void) {
int i = 2;
int a[] = {0,1,2,3,4};
int n = sizeof(a) / sizeof(a[0]);
for (i = 0; i < n; i++) {
(*(a+i))++;
printf(" %d", a[i]);
}
printf("\n");
return 0;
}
Question 9 options:
| A |
It does not compile. |
| B |
It prints: 1 1 1 1 1 |
| C |
Prints: 1 2 3 4 5. |
| D |
It crashes because it causes a segmentation fault. |
Question 10
What does the following program do?
#include
int main(void) {
int * p;
int a[] = {0,1,2,3,4};
int n = sizeof(a) / sizeof(a[0]);
for (p = a; p != a+n; p++) {
printf(" %d", *p);
}
printf("\n");
return 0;
}
Question 10 options:
| A |
It crashes because p != a+n accesses an address that isout of bounds. |
| B |
It doesn't compile. You cannot assign an array to a pointer because they are of different types. |
| C |
It prints nonsense because %d is for integers, while p is a pointer. |
| D |
It prints: 0 1 2 3 4 |
In: Computer Science