List any 5 Unix commands with their brief description.
In: Computer Science
You will extend last week's workshop activity by adding a Player class. Each player has a number of Pokemons, and the player can select one of his or her Pokemon to play against another player's Pokenmon. The player who lost the battle lost his or her Pokemon to the other player.
You will be working with three.java files in this zyLab.
Complete the Player class with the following specifications:
(1) add the following three private fields
(2) add a constructor, which takes one parameter to initialize the name field. The level is initialized as 0. The constructor also creates the ArrayList.
(3) add each of the following public member methods
Complete the PokemonField.java
PokemonField.java
import java.util.Random;
import java.util.Scanner;
public class PokemonField {
public static void main(String[] args) {
Player player1 = new Player("dragonslayer");
Player player2 = new Player("voldemort");
Random random = new Random();
initialize(player1, player2);
player1.printStat();
player2.printStat();
play(random, player1, player2);
System.out.println("Game over");
player1.printStat();
player2.printStat();
}
public static boolean fight(Random random, Pokemon p1, Pokemon
p2){
double prob = (double)p1.getAttackPoints() / (p1.getAttackPoints()
+ p2.getAttackPoints());
while(p1.getHitPoints() > 0 && p2.getHitPoints() > 0)
{
if(random.nextDouble() < prob) {
p2.setHitPoints(Math.max(p2.getHitPoints()- p1.getAttackPoints(),
0));
}
else{
p1.setHitPoints(Math.max(p1.getHitPoints() - p2.getAttackPoints(),
0));
}
}
if(p1.getHitPoints() > 0){
System.out.println(p1.getName() + " won!");
return true;
}
else {
System.out.println(p2.getName() + " won!");
return false;
}
}
public static void initialize(Player player1, Player player2)
{
String[] pokemonNames1 = {"Butterfree", "Ivysaur", "Pikachu",
"Squirtle"};
int[] pokemonMaxHps1 = {10, 15, 20, 30};
int[] pokemonAps1 = {1, 2, 2, 3};
String[] pokemonNames2=
{"Jigglypuff","Oddish","Gloom","Psyduck","Machop"};
int[] pokemonMaxHps2 = {12, 18, 25, 27, 32};
int[] pokemonAps2 = {1, 1, 2, 2, 3};
for(int i = 0; i < pokemonNames1.length; i++) {
/*FIX(1) create a Pokemon object with the following three
arguments:pokemonNames1[i], pokemonMaxHps1[i], pokemonAps1[i]
Add the Pokemon object to the Pokemon array list in player1
Increment player1's level by 1*/
}
for(int i = 0; i < pokemonNames2.length; i++) {
/*FIX(2) create a Pokemon object with the following three
arguments:pokemonNames2[i], pokemonMaxHps2[i], pokemonAps2[i]
Add the Pokemon object to the Pokemon array list in player2
Increment player2's level by 1*/
}
}
public static void play(Random random, Player player1, Player
player2) {
Pokemon p1, p2;
int index1, index2;
Scanner scnr = new Scanner(System.in);
boolean result;
System.out.println("Let's play!");
System.out.println(player1.getName() + " choose a pokemon to
fight\nenter 1 to " + player1.getPokemons().size() + " or -1 to
stop");
index1 = scnr.nextInt();
System.out.println(player2.getName() + " choose a pokemon to
fight\nenter 1 to " + player2.getPokemons().size() + " or -1 to
stop");
index2 = scnr.nextInt();
while(index1 != -1 && index2 != -1) {
p1 = player1.getPokemons().get(index1-1);
p2 = player2.getPokemons().get(index2-1);
result = fight(random, p1, p2);
if(result) {
/*FIXME(3) p1 won, reset p2, remove p2 from player2, and add p2 to
player 1, increment player1's level by 1*/
}
else {
/*FIXME(4) p2 won, reset p1, remove p1 from player1, and add p1 to
player 2, increment player2's level by 1*/
}
System.out.println(player1.getName() + " choose a pokemon to
fight\nenter 1 to " + player1.getPokemons().size() + " or -1 to
stop");
index1 = scnr.nextInt();
System.out.println(player2.getName() + " choose a pokemon to
fight\nenter 1 to " + player2.getPokemons().size() + " or -1 to
stop");
index2 = scnr.nextInt();
}
}
}
Player.java
import java.util.ArrayList;
public class Player {
/*FIXME(1) Add three fields: name, level, pokemons*/
/*FIXME(2) Add a constructor, which takes one parameter: String
n.
Initialize name to n, level to 0, and create an ArrayList for
pokemons*/
/*FIXME (3) Define the accessor for name*/
/*FIXME (4) Define the accessor for level*/
/*FIXME (5) Define the accessor for pokemons*/
/*FIXME (6) Define the mutator for level*/
/*FIXME(7) Complete this method by adding p into the Pokemon
ArrayList*/
public void addPokemon(Pokemon p){
}
/*FIXME(8) Complete this method by removing p from the Pokemon
ArrayList*/
public void removePokemon(Pokemon p){
}
public void printStat(){
System.out.println("\nPlayer: " + name + " at level " + level + ",
has " + pokemons.size() + " pokemons");
/*FIXME(9) Complete this method by printing the stat of each
pokemon in the Pokemon ArrayList.
Each pokemon's stat is printed in an individual line. Hint: loop
through the ArrayList and call the printStat method of Pokemon
class*/
}
}
Pokemon.java
public class Pokemon {
private String name;
private int maxHp;
private int hitPoints;
private int attackPoints;
public Pokemon(String name, int maxHp, int ap) {
this.name = name;
this.maxHp = maxHp;
hitPoints = maxHp;
attackPoints = ap;
}
public String getName(){
return name;
}
public int getHitPoints() {
return hitPoints;
}
public int getAttackPoints() {
return attackPoints;
}
public void setHitPoints(int hp) {
hitPoints = hp;
}
public void setAttackPoints(int ap) {
attackPoints = ap;
}
public void reset() {
hitPoints = maxHp;
}
public void printStat() {
System.out.println(name + " has " + hitPoints + " hit points and "
+ attackPoints + " attack points");
}
}
/*FIXME(2) Add a constructor, which takes one parameter: String
n.
Initialize name to n, level to 0, and create an ArrayList for
pokemons*/
/*FIXME (3) Define the accessor for name*/
/*FIXME (4) Define the accessor for level*/
/*FIXME (5) Define the accessor for pokemons*/
/*FIXME (6) Define the mutator for level*/
/*FIXME(7) Complete this method by adding p into the Pokemon
ArrayList*/
public void addPokemon(Pokemon p){
}
/*FIXME(8) Complete this method by removing p from the Pokemon
ArrayList*/
public void removePokemon(Pokemon p){
}
public void printStat(){
System.out.println("\nPlayer: " + name + " at level " + level + ",
has " + pokemons.size() + " pokemons");
/*FIXME(9) Complete this method by printing the stat of each
pokemon in the Pokemon ArrayList.
Each pokemon's stat is printed in an individual line. Hint: loop
through the ArrayList and call the printStat method of Pokemon
class*/
}
}
In: Computer Science
This lesson's Group Activities are:
Use python and use double strings
Talk like a Pirate! In this activity you are to create an English to Pirate Translator. Users should input a phrase and your program should translate it into pirate speak. A few rules:
1. Certain words need to be converted:
2. You need to obey capitalization and punctuation: if the word is capitalized, then its translation should also be capitalized. If the sentence ends in a period, then the translation should end in a period. To keep punctuation simple, you can stick to coding for commas and periods, and ignore all the rest.
3. Pirates like the word "arr". For fun, randomly insert it into your translation.
4. Remember to use all the tools in your arsenal, especially mainline logic, functions, loops, and error handling.
In: Computer Science
C++ Programming
Convert problems 6 in to template classes, of week 5 and week 4.
Test each with Implicit int, float, double, long int.
Test each with explicit int, float, double, long int.
Problem 6:
//Box.h
#include<iostream>
using namespace std;
class Box
{
public:
double Length;
double Width;
double Height;
public:
//Default constructor
Box();
//Parameterized constructor
Box(double ,double,double);
//Setter methods
void setWidth ( double n ) ;
void setDepth ( double n ) ;
void setHeight ( double n );
//getter methods
double getWidth () ;
double getHeight ();
double getDepth () ;
//Methods to calculate area and volume of box
double calcArea () ;
double calcVolume () ;
};
//Box.cpp
#include <iostream>
#include "Box.h"
using namespace std;
//default constructor
Box::Box()
{
Length = 0;
Width = 0;
Height = 0;
}
//parameterized constructor
Box::Box(double l,double w, double h)
{
Length = l;
Width = w;
Height = h;
}
void Box::setWidth ( double n )
{
Width = n;
}
void Box::setDepth ( double n )
{
Length = n;
}
void Box::setHeight ( double n )
{
Height = n;
}
double Box::getWidth ()
{
return Width;
}
double Box::getHeight ()
{
return Height;
}
double Box::getDepth ()
{
return Length;
}
double Box::calcArea ()
{
return 2*(Length*(Width+Height)+Width*Height);
}
double Box::calcVolume ()
{
return Length*Width*Height;
}
------
//main.cpp
#include<iostream>
#include<string>
#include "Box.h"
using namespace std;
//start of main method
int main()
{
cout<<"Name";
string myName= "yourname";
cout<<"Name: "<<myName<<endl;
//default constructor
Box B1;
cout<<"Testing default constructor"<<endl;
cout << "Height = " << B1.getHeight() << endl;
cout << "Area = " << B1.calcArea() << endl;
cout << "Volume = " << B1.calcVolume() << endl;
//parmeter constructor
Box B2(1,2,3);
cout<<"Testing parameterized constructor"<<endl;
cout << "Height = " << B2.getHeight() << endl;
cout << "Area = " << B2.calcArea() << endl;
cout << "Volume = " << B2.calcVolume() << endl;
Box B3;
B3.setWidth(3);
B3.setDepth(5);
B3.setHeight(10);
cout<<"Testing functions "<<endl;
cout << "Height = " << B3.getHeight() << endl;
cout << "Area = " << B3. calcArea() << endl;
cout << "Volume = " << B3.calcVolume() << endl;
system("pause");
return 0;
}
In: Computer Science
Modifying the tree traversal C program shown below to do reversed tree traversal as defined below.
Reversed PreOrder: Root, Right, Left.
Reversed InOrder: Right, Root, Left.
Reversed PostOrder: Right, Left, Root.
The tree is:
Root = 1, Left(1) = -2, Right(1) = -3;
Left(-2) = 4, Right(-2) = 5;
Left(-3) = 6, Right(-3)= 7;
Left(5) = -8, Right(5)= -9;
Left(7) = 10, Right(7) = 11;
Left(11) = -12, Right(11) = -13;
Left(-13) = 14.
Your program should output the printed sequence of node IDs (positive or negative) according to the required order.
Code:
// C program for different tree traversals
#include <stdio.h>
#include <stdlib.h>
/* A binary tree node has data, pointer to left child
and a pointer to right child */
struct node
{
int data;
struct node* left;
struct node* right;
};
/* Helper function that allocates a new node with the
given data and NULL left and right pointers. */
struct node* newNode(int data)
{
struct node* node = (struct node*)
malloc(sizeof(struct
node));
node->data = data;
node->left = NULL;
node->right = NULL;
return(node);
}
/* Given a binary tree, print its nodes according to the
"bottom-up" postorder traversal. */
void printPostorder(struct node* node)
{
if (node == NULL)
return;
// first recur on left subtree
printPostorder(node->left);
// then recur on right subtree
printPostorder(node->right);
// now deal with the node
printf("%d ", node->data);
}
/* Given a binary tree, print its nodes in inorder*/
void printInorder(struct node* node)
{
if (node == NULL)
return;
/* first recur on left child */
printInorder(node->left);
/* then print the data of node */
printf("%d ", node->data);
/* now recur on right child */
printInorder(node->right);
}
/* Given a binary tree, print its nodes in preorder*/
void printPreorder(struct node* node)
{
if (node == NULL)
return;
/* first print data of node */
printf("%d ", node->data);
/* then recur on left sutree */
printPreorder(node->left);
/* now recur on right subtree */
printPreorder(node->right);
}
/* Driver program to test above functions*/
int main()
{
struct node *root = newNode(1);
root->left
= newNode(2);
root->right =
newNode(3);
root->left->left = newNode(4);
root->left->right = newNode(5);
printf("\nPreorder traversal of binary tree is
\n");
printPreorder(root);
printf("\nInorder traversal of binary tree is
\n");
printInorder(root);
printf("\nPostorder traversal of binary tree is
\n");
printPostorder(root);
getchar();
return 0;
}
In: Computer Science
Based on the question below, construct an outline of two body paragraphs. Write your outline in complete sentences.
The mass media, which includes television, radio, newspapers or social networking sites, plays an important role in society. What are the positive effects of mass media on today’s generation?
Explain your views by providing two effects.
Thesis statement:
___________________________________________________________________
Body Paragraph 1
Topic Sentence:
___________________________________________________________________
Supporting Sentences:
1. ___________________________________________________________________
2. ___________________________________________________________________
Concluding Sentence:
___________________________________________________________________
Body Paragraph 2
Topic Sentence:
___________________________________________________________________
Supporting Sentences:
1. ___________________________________________________________________
2. ___________________________________________________________________
Concluding Sentence:
___________________________________________________________________
In: Computer Science
The program you will be writing displays a weekly payroll report. A loop in the program should ask the user for the employee's number, last name, worked hours, hourly pay rate, state tax and federal tax rate. After data in entered and the user hits the enter key, the program will calculate gross an net pay, then displays all employee's payroll information, and ask for the next employees' information. if worked hour is more than 40, double pay the hours worked more than 40 hours.
In the program, after done first employee, display "would you like to enter next employee's information?"
if the user type "y", "Y", "YES", "Yes", "YEs", "yES", "yeS", the program should prompt for second employee info entry.
if the user type "n", "N", "No","NO", nO", "no", the program should exit.
Need the code in Java (I have struggle in the big loop when asking input second employee's info or not).
In: Computer Science
Design and implement a binary-encoded sequential circuit subject to the following specifications.
This circuit is going to be used to control access to security system. It has a single 2-bit wide input, called X = X1X0 that represents a key-pad that is capable of accepting numbers 0 to 3, representing digits of a passcode. It has a single 1-bit wide output, called F, that is attached to the disarming mechanism. The behavior is that if the correct passcode is entered (in the proper order) on X (where the rising edge of the clock represents ‘entering’ the each ‘digit’ of the passcode on X into the system), then the output, F, will be asserted to 1, otherwise, it outputs 0. The 3-digit passcode is 2,1,3. When implementing the binary encoded circuit, show both the minimum sum of product (MSOP) technique and equations.
In: Computer Science
Security should be a top concern for every network environment. This is especially true in a converged network. Many mission-critical services depend on this infrastructure. A security breach could cause devastating effects on the environment. All measures must be taken to reduce the risk of a security breach.
In 3–4 paragraphs, complete the following:
In: Computer Science
**Use Python 3.7.4 ***
1. Ask the user for the number of hours worked, salary per hour and compute their salary. They will make 1.5 times salary for every hour over 40.
2. Write a program that asks the user for red, green, and blue color mixture (3 inputs); all or nothing - you can decide how to do this (0/1), (0/255), (none/all), (...). Then based on the combination display the final color: (white - 111, red - 100, green - 010, blue - 001, cyan - 011, magenta - 101, yellow - 110, black - 000)
3. Write a program and asks user for a phone number with area code. Must be formatted like this, " (###)-###-#### " the program should say whether or not it is in the valid format.
In: Computer Science
Solve f(x) = x3 + 12x2 - 100x – 6 using false position with a = 5, b = 6, and es =0.5%. Show each step and create a table. Please be as detailed as you can.
In: Computer Science
Enhance your program from Exercise 20 by continuing to ask the user for the interest rate and loan amount. Then ask the user for the amount of principle they would like to payoff each month. Make sure that the user enters a positive number that is less than the loan amount. This means that the monthly payment will change from month to month. Use this information to produce a payment chart that will include as output the Payment (Month) Number, the Payment Amount (monthly amount + interest), and the interest for that month. Make sure to calculate the Payment Amount for the last month as the remaining Loan Amount + Interest. At the end of the payment chart, output the total interest paid.
Ask user for loan amount, interest rate and monthly principle payment.
Check to make sure the monthly principle payment is less than the loan amount.
Set month counter and total interest to zero
Repeat until loan amount is less than or equal principle payment
Calculate interest as loan amount * interest rate
Calculate payment as interest + principle payment
Add interest to total interest
Increment month counter
print the month counter, payment amount and interest
Subtract principle payment from loan amount
Calculate final interest = loan amount * interest rate
Calculate final payment = loan amount + final interest
increment the month counter
Add final interest to total interest
print the month counter, final payment and final interest
print the total interest
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
double loanAmount;
double interestRate;
double interestRatePerMonth;
double monthlyPayment;
double paymentPrincipal;
int months;
cout << fixed << showpoint;
cout << setprecision(2);
cout << "Enter the loan amount: ";
cin >> loanAmount;
cout << endl;
cout << "Enter the interest rate per year:
";
cin >> interestRate;
cout << endl;
interestRatePerMonth = (interestRate / 100) /
12;
cout << "Enter the monthly payment:
";
cin >> monthlyPayment;
if (monthlyPayment <= loanAmount *
interestRatePerMonth)
{
cout << "Monthly
payment is too low. The loan cannot be repaid."
<< endl;
return 1;
}
months = 0;
while (loanAmount > 0)
{
paymentPrincipal =
monthlyPayment - (loanAmount * interestRatePerMonth);
loanAmount = loanAmount
- paymentPrincipal;
months++;
}
cout << "It will take " << months
<< " months to repay the loan."
<<
endl;
return 0;
}
In: Computer Science
In: Computer Science
Task 1.
For each table on the list, identify the functional dependencies. List the functional dependencies. Normalize the relations to BCNF. Then decide whether the resulting tables should be implemented in that form. If not, explain why. For each table, write the table name and write out the names, data types, and sizes of all the data items, Identify any constraints, using the conventions of the DBMS you will use for implementation. Write and execute SQL statements to create all the tables needed to implement the design.
Create indexes for foreign keys and any other columns that will be used most often for queries. Insert about five records in each table, preserving all constraints. Put in enough data to demonstrate how the database will function. Write SQL statements that will process five non-routine requests for information from the database just created. For each, write the request in English, followed by the corresponding SQL command. Create at least one trigger and write the code for it.
Tables / DDL and Insert Data have been provided below:
-- DDL to create the MS SQL tables for initial relational model
for Theater Group
CREATE DATABASE Theater;
CREATE TABLE Member(
memId INT,
dateJoined DATETIME,
firstname VARCHAR(15),
lastName VARCHAR(20),
street
VARCHAR(50),
city
VARCHAR(15),
state
CHAR(2),
zip
CHAR(5),
areaCode CHAR(3),
phoneNumber CHAR(7),
currentOfficeHeld VARCHAR(20),
CONSTRAINT Member_memId_pk PRIMARY
KEY(memid));
CREATE TABLE Sponsor(
sponID INT,
name
VARCHAR(20),
street
VARCHAR(50),
city
VARCHAR(15),
state
CHAR(2),
zip
CHAR(5),
areaCode CHAR(3),
phoneNumber CHAR(7),
CONSTRAINT Sponsor_sponId_pk PRIMARY
KEY(sponID));
CREATE TABLE Subscriber(
subID INT,
firstname VARCHAR(15),
lastName VARCHAR(20),
street
VARCHAR(50),
city
VARCHAR(15),
state
CHAR(2),
zip
CHAR(5),
areaCode CHAR(3),
phoneNumber CHAR(7),
CONSTRAINT Subscriber_subId_pk PRIMARY
KEY(subID));
CREATE TABLE Play(
title
VARCHAR(100),
author
VARCHAR(35),
numberOfActs SMALLINT,
setChanges
SMALLINT,
CONSTRAINT Play_title_pk PRIMARY
KEY(title));
CREATE TABLE Production(
year
SMALLINT,
seasonStartDate VARCHAR(7),
seasonEndDate VARCHAR(7),
title
VARCHAR(100),
CONSTRAINT Prod_year_seasStDate_pk primary
key(year, seasonStartDate),
CONSTRAINT Prod_title_fk FOREIGN KEY(title)
REFERENCES Play(title));
CREATE TABLE Performance(
datePerf
VARCHAR(7),
timePerf
VARCHAR(10),
year
SMALLINT,
seasonStartDate VARCHAR(7),
CONSTRAINT Performance_date_pk PRIMARY
KEY(datePerf,year),
CONSTRAINT Performance_yr_seasStart_fk FOREIGN
KEY(year,seasonStartDate) REFERENCES Production(year,
seasonStartDate));
CREATE TABLE TicketSale(
saleID INT,
saleDate DATETIME,
totalAmount DECIMAL(6,2),
perfDate VARCHAR(7),
perfYear SMALLINT,
subId INT,
CONSTRAINT TicketSale_ID_PK PRIMARY
KEY(saleId),
CONSTRAINT TicketSale_perfDate_fk FOREIGN
KEY(perfDate,perfYear) REFERENCES Performance(datePerf,year),
CONSTRAINT TicketSale_subId_fk FOREIGN
KEY(subId) REFERENCES Subscriber(subId));
CREATE TABLE DuesPayment(
memId INT,
duesYear SMALLINT,
amount
DECIMAL(5,2),
datePaid DATETIME,
CONSTRAINT DuesPayment_memId_year_pk PRIMARY
KEY(memid, duesyear),
CONSTRAINT DuesPayment_memId_fk FOREIGN
KEY(memid) REFERENCES Member(memid));
CREATE TABLE Donation(
sponId
INT,
donationDate DATETIME,
donationType VARCHAR(20),
donationValue DECIMAL(8,2),
year
SMALLINT,
seasonStartDate VARCHAR(7),
CONSTRAINT Donation_sponId_date_pk PRIMARY
KEY(sponId, donationDate),
CONSTRAINT Donation_sponId_fk FOREIGN
KEY(sponId) REFERENCES Sponsor(sponId),
CONSTRAINT Donation_year_seasStartDate_fk
FOREIGN KEY(year,seasonStartDate) REFERENCES Production(year,
seasonStartDate));
CREATE TABLE Ticket(
saleId
INT,
seatLocation VARCHAR(3),
price
DECIMAL(5,2),
seattype
VARCHAR(15),
CONSTRAINT Ticket_saleid_pk PRIMARY KEY(saleId,
seatLocation),
CONSTRAINT Ticket_saleid_fk FOREIGN KEY(saleid)
REFERENCES TicketSale(saleId));
CREATE TABLE Member_Production(
memId
INT,
year
SMALLINT,
seasonStartDate VARCHAR(7),
role
VARCHAR(25),
task
VARCHAR(25),
CONSTRAINT Mem_Prod_Id_year_seas_pk PRIMARY
KEY(memId, year, seasonStartDate),
CONSTRAINT Mem_Prod_memId_FK FOREIGN KEY (memid)
REFERENCES Member(memId),
CONSTRAINT Mem_Prod_yr_seasStartDate_fk FOREIGN
KEY(year,seasonStartDate) REFERENCES
Production(year,seasonStartDate));
INSERT DATA:
-- insert some records
INSERT INTO Member values(11111,'01-Feb-2015',
'Frances','Hughes','10 Hudson Avenue','New
Rochelle','NY','10801','914','3216789','President');
INSERT INTO Member values(22222,'01-Mar-2015', 'Irene','Jacobs','1
Windswept Place','New
York','NY','10101','212','3216789','Vice-President');
INSERT INTO Member values(33333,'01-May-2015', 'Winston', 'Lee','22
Amazon Street','New York','NY',
'10101','212','3336789',null);
INSERT INTO Member values(44444,'01-Feb-2015', 'Ryan','Hughes','10
Hudson Avenue','New
Rochelle','NY','10801','914','5556789','Secretary');
INSERT INTO Member values(55555,'01-Feb-2015', 'Samantha',
'Babson','22 Hudson Avenue','New
Rochelle','NY','10801','914','6666789','Treasurer');
INSERT INTO Member values(66666,'01-Feb-2015', 'Robert',
'Babson','22 Hudson Avenue','New
Rochelle','NY','10801','914','6666789',null);
INSERT INTO Sponsor values(1234, 'Zap Electrics', '125 Main
Street','New York','NY', '10101', '212','3334444');
INSERT INTO Sponsor values(1235, 'Elegant Interiors', '333 Main
Street','New York','NY', '10101', '212','3334446');
INSERT INTO Sponsor values(1236, 'Deli Delights', '111 South
Street', 'New Rochelle','NY','10801', '914','2224446');
INSERT INTO Subscriber values(123456, 'John','Smith','10
Sapphire Row', 'New Rochelle','NY','10801', '914','1234567');
INSERT INTO Subscriber values(987654, 'Terrence','DeSimone','10
Emerald Lane','New York','NY', '10101','914','7676767');
INSERT INTO Play values('Macbeth','Wm. Shakespeare', 3,6);
INSERT INTO Play values('Our Town','T. Wilder', 3,4);
INSERT INTO Play values('Death of a Salesman','A. Miller',
3,5);
INSERT INTO Production values(2015,'05-May', '14-May', 'Our
Town');
INSERT INTO Production
values(2014,'14-Oct','23-Oct','Macbeth');
INSERT INTO Performance values('05-May','8pm',2015,'05-May');
INSERT INTO Performance values('06-May','8pm',2015,'05-May');
INSERT INTO Performance values('07-May','3pm',2015,'05-May');
INSERT INTO Performance values('12-May','8pm',2015,'05-May');
INSERT INTO Performance values('13-May','8pm',2015,'05-May');
INSERT INTO Performance values('14-May','3pm',2015,'05-May');
INSERT INTO Performance values('14-Oct','8pm',2014,'14-Oct');
INSERT INTO Performance values('15-Oct','8pm',2014,'14-Oct');
INSERT INTO Performance values('16-Oct','3pm',2014,'14-Oct');
INSERT INTO Performance values('21-Oct','8pm',2014,'14-Oct');
INSERT INTO Performance values('22-Oct','8pm',2014,'14-Oct');
INSERT INTO Performance values('23-Oct','3pm',2014,'14-Oct');
INSERT INTO TicketSale
values(123456,'01-May-2015',40.00,'05-May',2015,123456);
INSERT INTO Ticket values(123456, 'A1',20.00,'orch front');
INSERT INTO Ticket values(123456, 'A2',20.00,'orch front');
INSERT INTO TicketSale
values(123457,'02-May-2015',80.00,'05-May',2015,987654);
INSERT INTO Ticket values(123457, 'A3',20.00,'orch front');
INSERT INTO Ticket values(123457, 'A4',20.00,'orch front');
INSERT INTO Ticket values(123457, 'A5',20.00,'orch front');
INSERT INTO Ticket values(123457, 'A6',20.00,'orch front');
INSERT INTO TicketSale
values(000001,'01-Oct-2014',40.00,'14-Oct',2014, 987654);
INSERT INTO Ticket values(000001, 'A1',20.00,'orch front');
INSERT INTO Ticket values(000001, 'A2',20.00,'orch front');
INSERT INTO TicketSale
values(000002,'9-Oct-2014',60.00,'14-Oct',2014,123456);
INSERT INTO Ticket values(000002, 'A1',20.00,'orch front');
INSERT INTO Ticket values(000002, 'A2',20.00,'orch front');
INSERT INTO Ticket values(000002, 'A3',20.00,'orch front');
INSERT INTO DuesPayment values(11111, 2015, 50.00,
'01-Jan-2015');
INSERT INTO DuesPayment values(22222, 2015, 50.00,
'15-Jan-2015');
INSERT INTO DuesPayment values(33333, 2015, 50.00,
'01-Feb-2015');
INSERT INTO DuesPayment values(44444, 2015, 50.00,
'30-Jan-2015');
INSERT INTO DuesPayment values(55555, 2015, 50.00,
'28-Jan-2015');
INSERT INTO Donation values(1234, '01-Mar-2015','sound
board',1250.00,2015,'05-May');
INSERT INTO Donation values(1235, '15-Apr-2015','cash',
500.00,2015,'05-May');
INSERT INTO Donation values(1236,
'05-May-2015','food',500.00,2015,'05-May');
INSERT INTO Donation values(1236,
'06-May-2015','beverges',200.00,2015,'05-May');
INSERT INTO Donation values(1236,
'07-May-2015','snacks',100.00,2015,'05-May');
INSERT INTO Member_Production
values(11111,2015,'05-May','Emily','sets');
INSERT INTO Member_Production values(22222,2015,'05-May','Mrs.
Webb','costumes');
-- DDL to delete all of the tables, use only if you need to
rebuild the DB
DROP TABLE Member_Production;
DROP TABLE Ticket;
DROP TABLE Donation;
DROP TABLE DuesPayment;
DROP TABLE TicketSale;
DROP TABLE Performance;
DROP TABLE Production;
DROP TABLE Play;
DROP TABLE Subscriber;
DROP TABLE Sponsor;
DROP TABLE Member;
DROP DATABASE Theater;
In: Computer Science
Create two files, file1.csv and file2.csv
Write the following information in file1.csv:
Apple 1.69 001
Banana 1.39 002
Write the following information in file2.csv:
Apple 1.69 001
Carrot 1.09 003
Beef 6.99 004
You have two files, both of the two files have some information about products: • Read these two files, find out which products exist in both files, and then save these products in a new file. You can use the two files you created in Lab 1 as an example. If you use file1.csv and file2.csv from Lab 1, the result file will be:
•Result file:
Apple 1.69 001
In: Computer Science