Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking.
Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid: integer, shipdate: Date/Time) ShippedProduct(sid: integer, pid: integer, amount: integer)
Output:
+--------------+ | pname | +--------------+ | Wooden Chair | +--------------+
Output: (Note: Order of rows does not matter.)
+-----------------+-------+ | cname | state | +-----------------+-------+ | Fred Smith | IL | | Joe Smithsonian | IA | | Steve Stevenson | IL | | Russell Johnson | CA | | John Doe | MI | | Scott Charles | CA | | Shannon Rose | MI | | Beth Rosebud | IA | | Suzanne May | IA | +-----------------+-------+
Output:
+-----+----------------+ | sid | Total_Shipment | +-----+----------------+ | 12 | 45.49 | | 8 | 98.75 | | 7 | 98.97 | | 10 | 104.00 | | 4 | 164.95 | | 6 | 183.96 | | 11 | 260.00 | | 3 | 659.80 | | 5 | 676.00 | | 9 | 1664.00 | +-----+----------------+
In: Computer Science
In MATLAB:
x = [1 3 4 6 7 10 11 15 16]
y = [20 24 25 30 32 34 39 41 48]
This is an exercise in numerical differentiation.
Using the central difference method where possible, find dy/dx for the data set provided. Plot results.
In: Computer Science
so i want to read in a file. just to keep it simple, the text file has student name and the grade, separated by a space. let's say there are 192 student's name and I want to read them in and made them into a Student /object class, which has a constructor, student(string name, int grade). individually creating them seems pain in the ass. reading in should work for any number of names.
So how do I do this in c++?
In: Computer Science
Write program that prompts the user to enter a person's date of birth in numeric form such as 8-27-1980. The program then outputs the date of birth in the form: August 27, 1980. Your program must contain at least two exception classes: invalidDay and invalidMonth. If the user enters an invalid value for day, then the program should throw and catch an invalidDay object. Similar conventions for the invalid values of month and year. (Note that your program must handle a leap year.)
In: Computer Science
a. Define the components of Case’s model (i.e., Storage Space, Operating Space)
b. Describe how the components of Case’s model change from early childhood (e.g., age 6 years) to late adolescence (e.g., age 18 years). You must provide written descriptions and you must describe how the components of Case’s model change over time.
In: Computer Science
Please fix these errors C++
In file included from main.cpp:14:0:
Inventory.h:1:0: error: unterminated #ifndef
#ifndef INVENTORY_H_
main.cpp: In function ‘int main()’:
main.cpp:82:35: error: ‘adds’ was not declared in this scope
noun= adds(noun);
^
main.cpp:88:32: error: ‘display’ was not declared in this scope
display(noun);
^
In file included from Inventory.cpp:4:0:
Inventory.h:1:0: error: unterminated #ifndef
#ifndef INVENTORY_H_
----------------------------------------------------------------------------------
CODE: main.cpp
#include<iostream>
#include<string>
#include<vector>
#include "Inventory.h"
using namespace std;
int main()
{
Node * noun=NULL;
Node * verb=NULL;
int choice=0;
while(choice!=8)
{
cout<<"1. Push Noun\n";
cout<<"2. Pop Noun\n";
cout<<"3. Push Verb\n";
cout<<"4. Pop Verb\n";
cout<<"5. Concatenate\n";
cout<<"6. Add an s\n";
cout<<"7. Display Both Stacks\n";
cout<<"8. Exit\n";
cout<<"Enter your choice: ";
cin>>choice;
switch(choice)
{
case 1:
{
cout<<"Enter a noun: ";
string n;
cin>>n;
noun = push(noun,n);
}
break;
case 2:
{
cout<<"NOUN POPPED: ";
Node * t = pop(&noun);
if(t!=NULL)
cout<<t->data<<endl;
}
break;
case 3:
{
cout<<"Enter a verb: ";
string n;
cin>>n;
verb = push(verb,n);
}
break;
case 4:
{
cout<<"Verb POPPED: ";
Node * t = pop(&verb);
if(t!=NULL)
cout<<t->data<<endl;
}
break;
case 5: {
cout<<"Top two words on noun stack concatenated\n";
noun = concat(noun);
}
break;
case 6:
{
cout<<"Add s to the top word on noun stack\n";
noun = adds(noun);
}
break;
case 7:
{
cout<<"NOUN STACK\n";
display(noun);
cout<<"VERB STACK\n";
display(verb);
}
case 8:
{
}
break;
default: cout<<"Enter a valid choice\n";
}
}
return 0;
}
CODE: Inventory.cpp
#include<iostream>
#include<string>
#include<vector>
#include "Inventory.h"
using namespace std;
//display
void display(Node * head)
{
if(head==NULL)
{
return;
}
vector<string> stack;
Node * cur = head;
while(cur!=NULL)
{
stack.push_back(cur->data);
cur=cur->next;
}
for(int i = stack.size()-1;i>=0;--i)
{
cout<<stack.at(i)<<" ";
}
cout<<endl;
}
Node * adds(Node *head)
{
Node * top1 = pop(&head);
if(top1!=NULL)
{
//add s
string sol= top1->data + "s";
head=push(head,sol);
}
return head;
}
CODE: inventory.h
#ifndef INVENTORY_H_
#define INVENTORY_H_
#include<iostream>
using namespace std;
class Node
{
public:
string data;
Node * next;
Node()
{
data="";
next=NULL;
}
Node(string data)
{
data=data;
next=NULL;
}
};
Node * push(Node * head, string data)
{
if(head==NULL)
{
head=new Node();
head->data=data;
return head;
}
Node * cur = head;
while(cur->next!=NULL)
{
cur=cur->next;
}
Node * temp = new Node();
temp->data=data;
cur->next=temp;
return head;
}
Node * pop(Node ** h)
{
Node * head = *h;
if(head==NULL)
return NULL;
if(head->next==NULL)
{
Node * temp = head;
*h = NULL;
return temp;
}
Node * cur = head;
Node * prev = head;
while(cur->next!=NULL)
{
prev=cur;
cur=cur->next;
}
prev->next=NULL;
return cur;
}
Node * concat(Node * head)
{
Node * top1 = pop(&head);
Node * top2 = pop(&head);
if(top1!=NULL && top2!=NULL)
{
string solution = top1->data + top2->data;
head= push(head,solution);
}
return head;
}
In: Computer Science
In MATLAB:
x = [1 3 4 6 7 10 11 15 16] y = [20 24 25 30 32 34 39 41 48]
This is an exercise in numerical differentiation.
Using the central difference method where possible, find dy/dx for the data set provided. Plot results.
In: Computer Science
What is a reverse auction and when is it most likely to be used in a business-to-business setting?
In: Computer Science
Help, please!
In: Computer Science
1. Wite a program to exchange the contents of memory locations 2050H and 2370H using STA and LDA instructions.
In: Computer Science
Write a program that will calculate a 15% tip and a 13% tax on a meal price. The user will enter the meal price and the program will calculate tip, tax, and the total. The total is the meal price plus the tip plus the tax. Your program will then display the values of tip, tax, and total. Please format the output, also the round up to 2 decimal places.
In: Computer Science
represent 8912 in 16-bit binary format and then convert it to Hexadecimal form.
In: Computer Science
Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of the object using the formula: volume = mass / density. Format your output to two decimal places
In: Computer Science
What are the steps required to be performed by the Ext2 file system subsystem to delete a file of size 72KiB? Assume you know and have in memory a copy of the inode of the directory the file is in and the inode of the file to be deleted. Also assume the block size is 1024 bytes. Either list the steps required or use a flowchart.
In: Computer Science
represent -100 in 16-bit binary format and then convert it to Hexadecimal form.
In: Computer Science