Questions
This is in MySQL Part one: Using the MySQL Workbench Data Modeler, construct a diagram that...

This is in MySQL

Part one: Using the MySQL Workbench Data Modeler, construct a diagram that shows the table in 3rd Normal Form.

Part two: Provide a summary of the steps you took to achieve 3rd Normal form. Include your rationale for new table creation, key selection and grouping of attributes.

Table Details:

The Anita Wooten Art Gallery wishes to maintain data on their customers, artists and paintings. They may have several paintings by each artist in the gallery at one time. Paintings may be bought and sold several times. In other words, the gallery may sell a painting, then buy it back at a later date and sell it to another customer. Using MySQL Workbench Data Modeler, create a model showing the below table in 3rd Normal Form. Note that you only can model table and column names and data types. The data shown is for your reference to determine functional, partial, and transitive dependencies.

ArtistName

ArtistID

PurchaseDate

CustomerName

CustomerAddress

CustomerPhone

PurchasePrice

ArtTitle

Carol Channing

3

Sep 17 2012

Mark Evans

123 This Street Orlando, FL

(407) 555-1212

$         7,000.00

Laugh with Teeth

Dennis Frings

15

May 11 2013

Mark Evans

123 This Street Orlando, FL

(407) 555-1212

$         1,800.00

South Toward Emerald Sea

Carol Channing

3

Feb 14 2014

Mark Evans

123 This Street Orlando, FL

(407) 555-1212

$         5,550.00

At the Movies

Dennis Frings

15

Jul 15 2015

Mark Evans

123 This Street Orlando, FL

(407) 555-1212

$         2,200.00

South Toward Emerald Sea

In: Computer Science

Problem: Add a condition to the deposit method of the BankAccount class, restricting deposits to $100,000...

Problem:

Add a condition to the deposit method of the BankAccount class, restricting deposits to $100,000 (the insurance limit of the U.S. government). The method should block until sufficient money has been withdrawn by another thread. Test your program with a large number of deposit threads.

Bank account class: (THE ONE THAT NEEDS TO BE EDITED)

/**
A bank account has a balance that can be changed by
deposits and withdrawals.
*/
public class BankAccount
{
private double balance;

/**
Constructs a bank account with a zero balance.
*/
public BankAccount()
{
balance = 0;
}

/**
Deposits money into the bank account.
@param amount the amount to deposit
*/
public void deposit(double amount)
{
System.out.print("Depositing " + amount);
double newBalance = balance + amount;
System.out.println(", new balance is " + newBalance);
balance = newBalance;
}

/**
Withdraws money from the bank account.
@param amount the amount to withdraw
*/
public void withdraw(double amount)
{
System.out.print("Withdrawing " + amount);
double newBalance = balance - amount;
System.out.println(", new balance is " + newBalance);
balance = newBalance;
}

/**
Gets the current balance of the bank account.
@return the current balance
*/
public double getBalance()
{
return balance;
}
}

Included for test classes:

Bank Account threadrunner.java

/**
This program runs threads that deposit and withdraw
money from the same bank account.
*/
public class BankAccountThreadRunner
{
public static void main(String[] args)
{
BankAccount account = new BankAccount();
final double AMOUNT = 100;
final int REPETITIONS = 100;
final int THREADS = 100;

for (int i = 1; i <= THREADS; i++)
{
DepositRunnable d = new DepositRunnable(
account, AMOUNT, REPETITIONS);
WithdrawRunnable w = new WithdrawRunnable(
account, AMOUNT, REPETITIONS);

Thread dt = new Thread(d);
Thread wt = new Thread(w);

dt.start();
wt.start();
}
}
}

Withdraw runnable.java:

/**
A withdraw runnable makes periodic withdrawals from a bank account.
*/
public class WithdrawRunnable implements Runnable
{
private static final int DELAY = 1;
private BankAccount account;
private double amount;
private int count;

/**
Constructs a withdraw runnable.
@param anAccount the account from which to withdraw money
@param anAmount the amount to withdraw in each repetition
@param aCount the number of repetitions
*/
public WithdrawRunnable(BankAccount anAccount, double anAmount,
int aCount)
{
account = anAccount;
amount = anAmount;
count = aCount;
}

DepositRunnable.java

/**
A deposit runnable makes periodic deposits to a bank account.
*/
public class DepositRunnable implements Runnable
{
private static final int DELAY = 1;
private BankAccount account;
private double amount;
private int count;

/**
Constructs a deposit runnable.
@param anAccount the account into which to deposit money
@param anAmount the amount to deposit in each repetition
@param aCount the number of repetitions
*/
public DepositRunnable(BankAccount anAccount, double anAmount,
int aCount)
{
account = anAccount;
amount = anAmount;
count = aCount;
}

public void run()
{
try
{
for (int i = 1; i <= count; i++)
{
account.deposit(amount);
Thread.sleep(DELAY);
}
}
catch (InterruptedException exception) {}
}
}

In: Computer Science

#Create a class called FrapOrder. FrapOrder should #have two attributes (instance variables): size and #extra_shots. Make...

#Create a class called FrapOrder. FrapOrder should
#have two attributes (instance variables): size and
#extra_shots. Make sure the variable names match those
#words. size will be a character, either "S", "M", or "L".
#extra_shots will be an integer.
#
#FrapOrder should have a constructor with two required
#parameters, one for each of those attributes (size and
#extra_shots, in that order).
#
#FrapOrder should also have a method called get_total.
#get_total should calculate the total cost of the order.
#If size is "S", the base cost is 2.50. If the size is "M",
#the base cost is 3.50. If the size is "L", the base cost is
#4.50. Then, each extra shot costs $0.35.
#
#For example, if size is "M" and extra_shots is 2, then
#get_total would return 4.2: 3.50 + 0.70 = 4.20 (and Python
#drops trailing 0s).
#
#total should NOT be an attribute of the class; instead,
#total should be calculated and returned live when the method
#get_total is called.
#
#The get_total method should have NO parameters besides self.
#Instead, it should calculate the total based on the current
#values for the size and extra_shots attributes.


#Write your class here!

#The code below will test your function. If it works, it
#should print "M" (without the quotes), 2, and 4.2 in that
#order.
test_order = FrapOrder("M", 2)
print(test_order.size)
print(test_order.extra_shots)
print(test_order.get_total())

In: Computer Science

Write a non recursive method to insert into an AVL tree in Java

Write a non recursive method to insert into an AVL tree in Java

In: Computer Science

2. Change the name of customer 842 to All Season Sport. Copy and paste your construct...

2.

Change the name of customer 842 to All Season Sport. Copy and paste your construct

here. Then, display the customer table. Insert your query and results here.

======================================================

Change the description of part BV06 to “Fitness Gym”. Insert your query and results

here.

======================================================

Database to use:

CREATE DATABASE premier_products;


#-- Creating Tables

USE premier_products;

#-- Rep Table

CREATE TABLE rep

(

rep_num char(2) primary key,

last_name varchar(15),

first_name varchar(15),

street varchar(15),

city varchar(15),

state char(2),

zip char(5),

commission decimal(7,2),

rate decimal(3,2)

);

#-- Customer table

CREATE TABLE customer

(

customer_num char(3) primary key,

customer_name varchar(30),

street varchar(15),

city varchar(15),

state char(15),

zip char(5),

balance decimal(7,2),

credit_limit decimal(7,2),

rep_num char(2)

);


#-- Orders table

CREATE TABLE orders

(

order_num char(5) primary key,

order_date timestamp,

customer_num char(3)

);


#-- Order_line table

CREATE TABLE order_line

(

order_num char(5),

part_num char(4),

num_ordered int(5),

quoted_price decimal(7,2),

PRIMARY KEY (order_num, part_num)

);

#-- Part table


CREATE TABLE part

(

part_num char(4) primary key,

description varchar(20),

on_hand int(4),

class char(2),

warehouse char(2),

price decimal (7,2)
);


#-- Populate rep table

INSERT INTO rep values ('20', 'Kaiser', 'Valerie', '624 Randall', 'Grove', 'FL', '33321', 20542.50, 0.05);

INSERT INTO rep values ('35', 'Hull', 'Richard', '532 Jackson', 'Sheldon', 'FL', '33553', 39216.00, 0.07);

INSERT INTO rep values ('65', 'Perez', 'Juan', '1626 Taylor', 'Fillmore', 'FL', '33336', 23487.00, 0.05);


#-- Populate customer table

INSERT INTO customer values ('148', 'Al''s Appliance and Sport', '2837 Greenway', 'Fillmore', 'FL', '33336',
6550.00, 7500.00, '20');

INSERT INTO customer values ('282', 'Brookings Direct', '3827 Devon', 'Grove', 'FL', '33321', 431.50, 10000.00, '35');

INSERT INTO customer values ('356', 'Ferguson''s', '382 Wildwood', 'Northfield', 'FL', '33146', 5785.00, 7500.00,
'65');

INSERT INTO customer values ('408', 'The Everything Shop', '1828 Raven', 'Crystal', 'FL', '33503', 5285.25, 5000.00, '35');

INSERT INTO customer values ('462', 'Bargains Galore', '3829 Central', 'Grove', 'FL', '33321', 3412.00, 10000.00, '65');

INSERT INTO customer values ('524', 'Kline''s', '838 Ridgeland', 'Fillmore', 'FL', '33336', 12762.00, 15000.00, '20');

INSERT INTO customer values ('608', 'Johnson''s Department Store', '372 Oxford', 'Sheldon', 'FL', '33553', 2106.00, 10000.00, '65');

INSERT INTO customer values ('687', 'Lee''s Sport and Appliance', '282 Evergreen', 'Altonville', 'FL', '32543', 2851.00, 5000.00, '35');

INSERT INTO customer values ('725', 'Deerfield''s Four Seasons', '282 Columbia', 'Sheldon', 'FL', '33553', 248.00, 7500.00, '35');

INSERT INTO customer values ('842', 'All Season', '28 Lakeview', 'Grove', 'FL', '33321', 8221.00, 7500.00, '20');

#-- Populate orders table

INSERT INTO orders value ('21608', '2015-10-20', '148');

INSERT INTO orders value ('21610', '2015-10-20', '356');
INSERT INTO orders value ('21613', '2015-10-21', '408');

INSERT INTO orders value ('21614', '2015-10-21', '282');

INSERT INTO orders value ('21617', '2015-10-23', '608');
INSERT INTO orders value ('21619', '2015-10-23', '148');

INSERT INTO orders value ('21623', '2015-10-23', '608');


#-- Populate order_line table

INSERT INTO order_line value ('21608', 'AT94', 11, 21.95);

INSERT INTO order_line value ('21610', 'DR93', 1, 495.00);

INSERT INTO order_line value ('21610', 'DW11', 1, 399.99);

INSERT INTO order_line value ('21613', 'KL62', 4, 329.95);

INSERT INTO order_line value ('21614', 'KT03', 2, 595.00);

INSERT INTO order_line value ('21617', 'BV06', 2, 794.95);

INSERT INTO order_line value ('21617', 'CD52', 4, 150.00);

INSERT INTO order_line value ('21619', 'DR93', 1, 495.00);

INSERT INTO order_line value ('21623', 'KV29', 2, 1290.00);


#--Populate part table

INSERT INTO part value ('AT94', 'Iron', 50, 'HW', '3', 24.95);

INSERT INTO part value ('BV06', 'Home Gym', 45, 'SG', '2', 794.95);

INSERT INTO part value ('CD52', 'Microwave Oven', 32, 'AP', '1', 165.00);

INSERT INTO part value ('DL71', 'Cordless Drill', 21, 'HW', '3', 129.95);

INSERT INTO part value ('DR93', 'Gas Range', 8, 'AP', '2', 495.00);

INSERT INTO part value ('DW11', 'Washer', 12, 'AP', '3', 399.99);

INSERT INTO part value ('FD21', 'Stand Mixer', 22, 'HW', '3', 159.95);

INSERT INTO part value ('KL62', 'Dryer', 12, 'AP', '1', 349.95);

INSERT INTO part value ('KT03', 'Dishwasher', 8, 'AP', '3', 595.00);

INSERT INTO part value ('KV29', 'Treadmill', 9, 'SG', '2', 1390.00);

In: Computer Science

Define two C structures, one to represent rectangular coordinates and one to represent polar coordinates. Rewrite...

Define two C structures, one to represent rectangular coordinates and one to represent polar coordinates. Rewrite the rec_to_polar function to use variables declared using the new structures.

In: Computer Science

1. (Important: Assume RTS/CTS mechanism is used) Suppose there are two ISPs providing WiFi access in...

1. (Important: Assume RTS/CTS mechanism is used) Suppose there are two ISPs providing WiFi access in the same café, with each ISP operating its own AP.

a. If each ISP has configured its AP to operate over the same channel, channel 11. Will the 802.11 protocol completely break down in this situation? Discuss what occurs when two devices, each associated with a different AP, attempt to transmit at the same time.

b. Suppose now one AP changes its channel to channel 1, and the other AP still operates over channel 11. How do you answer the change?

2. In IEEE 802.15.4, when BI=SD in superframe, what is the duty cycle? Can you achieve a duty cycle of 1%? And how?

In: Computer Science

Modify the included program to implement the strict alternation solution to achieve mutual exclusion. It does...

Modify the included program to implement the strict alternation solution to achieve mutual exclusion. It does not matter whether Thread 0 goes first or Thread 1, but it is important that the thread strictly alternate.

PROGRAM:

#include <iostream>
#include <pthread.h>
#include <stdlib.h>


int count;
int turn = 0; // Shared variable used to implement strict alternation


void* myFunction(void* arg)
{
   int actual_arg = *((int*) arg);
  
   for(unsigned int i = 0; i < 10; ++i) {
  
// TODO:
// Make sure that the thread waits for its turn
// before it enters the critical region.
//
// HINT: The thread ID is stored in actual_arg
  
while(turn != actual_arg);
  
  
  
// Beginning of the critical region
  
count++;
std::cout << "Thread #" << actual_arg << " count = " << count << std::endl;
  
// End of the critical region
  
  
  
// TODO:
// Make sure that the other thread gets a turn
//
// HINT: There are only two threads: 0 and 1
// You can use the C++ NOT operator (!)
// to toggle back and forth.
  
  


// Random wait - This code is just to ensure that the threads
// show data sharing problems
int max = rand() % 100000;
  
for (int x = 0; x < max; x++);
  
// End of random wait code
  
   }
  
   pthread_exit(NULL);
}


// HINT: It is not necessary to make any changes in main()
int main()
{
int rc[2];
pthread_t ids[2];
int args[2];
  
count = 0;
for(unsigned int i = 0; i < 2; ++i) {
args[i] = i;
rc[i] = pthread_create(&ids[i], NULL, myFunction, (void*) &args[i]);
}
  
for(unsigned int i = 0; i < 2; ++i) {
pthread_join(ids[i], NULL);
}
  
std::cout << "Final count = " << count << std::endl;
pthread_exit(NULL);
}

In: Computer Science

C# language. Answer in a discussion format. What is a loop? When do you use a...

  • C# language. Answer in a discussion format.
  • What is a loop? When do you use a loop versus a selection statement? What are some examples when an infinite loop is appropriate?
  • Describe one of the following three types of loops supported in C#:
    • while loop
    • for loop
    • do loop (or do-while loop)
  • Describe the steps necessary to make a while loop end correctly:
  • Explain the difference between incrementing and decrementing loop control variables.
  • Explain the benefits of using both pretest loops and posttest loops.
  • What are some examples when an infinite loop is appropriate?

In: Computer Science

CASE STUDY ----->>> "Sweet Tooth Cupcake and Pastry House Sweet Tooth has managed the company until...

CASE STUDY ----->>> "Sweet Tooth Cupcake and Pastry House

Sweet Tooth has managed the company until now basically running on a single Excel spreadsheet to determine costs, payroll hasn't been much of an issue because it has run with just the labor of its two original founders, and inventory has been managed by looking at the shelf to know how much is left.

Sales history has been difficult to maintain. The founders know how much money is coming in and how much is going out, but they don't know which products have been the most successful in terms of profit or sales volume other than by gut feel.

The time for an expansion to a second location and hiring of staff has come. With this expansion there will be additional needs for inventory management, sales tracking by product, location, etc., and payroll tracking.

This application needs to provide support for the following:

  1. Know what inventory (separate raw goods and finished products) is on hand at which location.
  2. Which inventory needs to be restocked due to quantity and lifespan.
  3. Know who has worked which shifts (basic scheduling) and how much they have earned.
  4. Sales reports with profit margins indicated, including over time (i.e. by month, quarter, etc.)
  5. Reports by quantity sold of items based on date so comparisons can be made to predict demand for holidays, etc.
  6. Equipment inventory and maintenance records.
  7. Take orders for large events online with customer information for confirmation."

Question

I am working as an analyst, i need to be familiar with the business case and identify 5 questions I need answered from each role listed below within the business that isn't evident from the case study.

BUSINESS ROLES INCLUDE :

BAKERY MANAGER

SUPERVISOR

SALES EXECUTIVE

INVENTORY/PROCUREMENT OFFICER

CASHIER

In: Computer Science

Please include all classes including driver. IN JAVA Suppose that there is a big farm in...

Please include all classes including driver.

IN JAVA

Suppose that there is a big farm in California that supplies the majority of the Grocery stores in the twin cities with vegetables and fruits. The stores submit their orders and receive the shipment a week later. Based on the size of the orders, the farm management decides on the size of the truck to load.

Create a Produce class that have an instance variable of type String for the name, appropriate constructors, appropriate accessor and mutator methods, and a public toString() method. Then create a Fruit and a Vegetable class that are derived from Produce. These classes should have constructors that take the name as a String, the price (this is the price per box) as a double, the quantity as an integer, and invoke the appropriate constructor from the base class to set the name. Also, they should override toString method to display the name of the produce, the price, and its type. For instance, Mango is a Fruit and Cauliflower is a Vegetable.

Finally, create a class called TruckOfProduce that will keep track of the boxes of Vegetables and Fruits added in to the truck. This class should use an array of Produce to store both vegetables and fruits. Also, it should have the following:

• Constructor that accepts an integer to initialize the array of Produce

• addProduce method that adds either fruit or vegetable to the array

• search method that accepts a name string, which can be either the name of a fruit or vegetable, and returns true if the name exists. Otherwise, it returns false.

• remove method that accepts a produce object and returns true if the produce is found and removed successfully. Otherwise, it returns false.

• computeTotal method that will return the total cost of all the produce in the truck.

• toString method that returns all the produce from in the truck.

• ensureCapacity method this is a void method. When this method is called it will double the size of the array and copy all the content of the smaller array in to this bigger array.

For instance, one could initialize the array to hold 1000 boxes of vegetables and fruits. What will happen if you try to add one more box (1001)? Of course, you will get an ArrayIndexOutOfBound error. So, thing about ensureCapacity as the method that will solve ArrayIndexOutBound error.

Then wrap it up with the driver class that tests all methods and displays the name of the produce, the price, and its type.

In: Computer Science

This is python: #Imagine you're writing a program to calculate the class #average from a gradebook....

This is python:

#Imagine you're writing a program to calculate the class
#average from a gradebook. The gradebook is a list of
#instances of the Student object.
#
#You don't know everything that's inside the Student object,
#but you know that it has a method called get_grade().
#get_grade() will return the average for the student
#represented by a given instance of Student.
#
#You don't know if get_grade() is stored in memory or if
#it's calculated when it's needed, but you don't need to.
#All you need to know is that the class Student has a method
#get_grade() that returns an integer representing the
#student's numeric grade.
#
#Write a function called class_average. class_average()
#should take as input a list of instances of Student, and it
#should return as output the average grade of those
#students, as calculated via their get_grade() method.
#Remember, average is the sum of all their individual
#grades, divided by the number of students.
#
#Hint: You do NOT need to write the Student class to
#complete this problem. You may if you want to in order to
#run and test your code, but when you submit your code for
#grading, we will test it with our Student class. Don't let
#this throw you off: throughout this course, you've been
#using lots of classes without knowing how they work: you
#don't know how the String class works, but you know what
#its upper() method does. You do not need to know how the
#Student class works to use its get_grade() method.


#Write your function here!

#If you want to write a Student class to test your code,
#you could below, and then add your own test cases below
#that. The only requirement you would need to meet is that
#your Student class would need to have a get_grade()
#method that returns an integer (in addition to any other
#usual requirements for classes).

In: Computer Science

This is python: #Write a function called count_positive_evens. This function #should take as input a list...

This is python:

#Write a function called count_positive_evens. This function
#should take as input a list of integers, and return as
#output a single integer. The number the function returns
#should be the count of numbers from the list that were both
#positive and even.
#
#For example:
#
# count_positive_evens([5, 7, 9, 8, -1, -2, -3]) -> 1
# count_positive_evens([2, 4, 6, 8, 10, 12, 15]) -> 6
# count_positive_evens([-2, -4, -6, -8, -10, 1]) -> 0
#
#0 should be not counted as a positive even number.
#
#Hint: Remember, even numbers are numbers that have a
#remainder of 0 when divided by 2.


#Write your function here!


#The lines below will test your code. Feel free to modify
#them. If your code is working properly, these will print
#the same output as shown above in the examples.
print(count_positive_evens([5, 7, 9, 8, -1, -2, -3]))
print(count_positive_evens([2, 4, 6, 8, 10, 12, 15]))
print(count_positive_evens([-2, -4, -6, -8, -10, 1]))

In: Computer Science

Modify the Encryption program so that it uses the following encryption algorithm: Every letter (both uppercase...

  1. Modify the Encryption program so that it uses the following encryption algorithm:

    • Every letter (both uppercase and lowercase) converted to its successor except z and Z, which are converted to 'a' and 'A' respectively (i.e., a to b, b to c, …, y to z, z to a, A to B, B to C, …, Y to Z, Z to A)

    • Every digit converted to its predecessor except 0, which is converted to 9 (i.e., 9 to 8, 8 to 7, … 1 to 0, 0 to 9)

    • Everything else unchanged.

Hand in:

Encryption.java

Note:

You must modify the specifications (API) of the methods involved as well.  

In: Computer Science

Suppose you have ridden a bicycle from New York City to Key West, Florida. Your bicycle...

Suppose you have ridden a bicycle from New York City to Key West, Florida. Your bicycle odometer shows the total miles you have travelled thus far, which you make a note of each day with paper and pencil. Your first two entries might be ‘55’ and ‘120’, indicating that you rode your bike 55 miles on day 1 and 65 miles on day 2. Your task is to create a NumPy array wherein you can record the cumulative miles you recorded each day during your trip “by hand”. Then use your Python skills to show the total miles that you rode each day. Assume the trip took a total of 35 days and included at least 4 non-consecutive days where no cycling was possible due to either weather conditions or personal fatigue/soreness. For the remaining 31 days, you would have covered the entire distance between NYC and Key West. Complete your work within your Jupyter Notebook for this assignment and be sure to include a writeup explaining your approach to this problem, including the ways in which you decided to make use of NumPy.

In: Computer Science