Search results for 'cit-150 chapter5 individual case'
-
DAT/380 Week 5 LAB 5.7 - Implement supertype and subtype entities (Sakila)
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 5 LAB 5.7 - Implement supertype and subtype entities (Sakila)
Refer to the customer and staff tables of the Sakila database. These tables have many columns in common and represent similar entities. Convert the customer and staff entities into subtypes of a new supertype person:
In the center is the person entity, with primary key person_id and additional attributes first_name, last_name, email, active, and last_update. The person entity contains subtype entities staff and customer. The staff entity has primary key person_id and additional attributes picture, username, and password. The customer entity has primary key person_id and additional attribute create_date. Cardinality does not appear after the primary keys and attributes. On the left is the address entity, connected to the person entity by the belongs_to relationship. Belongs_to has cardinality 1(1) on the address side and M(0) on the person side. On the right is the store entity, connected to the person entity by the works_at relationship. Works_at has cardinality 1(1) on the store side and M(0) on the person side.
The diagram uses Sakila naming conventions. Follow the Sakila conventions for your table and column names:
All lower case
Underscore separator between root and suffix
Foreign keys have the same name as referenced primary keyImplement supertype and subtype entities as person, customer, and staff tables with primary key person_id.
Implement attributes as columns:
All columns are NOT NULL.
The person_id columns have data type SMALLINT UNSIGNED.
The last_update and create_date columns have data type TIMESTAMP.
The picture column has data type BLOB.
All other columns have data type VARCHAR(20).Implement the dependency relationships between subtype and supertype entities as foreign keys:
The person_id columns of customer and staff become foreign keys referring to person.
Specify CASCADE actions for both relationships.Implement the belongs_to and works_at relationships as foreign keys:
belongs_to becomes an address_id foreign key in person referring to address.
works_at becomes a store_id foreign key in staff referring to store.
Specify RESTRICT actions for both relationships.The address and store tables, with primary keys address_id and store_id, are pre-defined in the zyLab environment. Foreign keys must have the same data types as the referenced primary keys:
address_id has data type SMALLINT UNSIGNED.
store_id has data type TINYINT UNSIGNED.If you execute your solution with the Sakila database, you must first drop customer, staff, and all constraints that refer to these tables. Use the following statements with Sakila only, not in the zyLab environment:
Learn More
DROP TABLE customer, staff;
ALTER TABLE payment
DROP CONSTRAINT fk_payment_customer,
DROP CONSTRAINT fk_payment_staff;
ALTER TABLE rental
DROP CONSTRAINT fk_rental_customer,
DROP CONSTRAINT fk_rental_staff;
ALTER TABLE store
DROP CONSTRAINT fk_store_staff; -
DAT/380 Week 5 LAB 5.6 - Implement independent entity (Sakila)
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 5 LAB 5.6 - Implement independent entity (Sakila)
Implement a new independent entity phone in the Sakila database. Attributes and relationships are shown in the following diagram:
The phone entity appears on the right. The phone entity contains four attributes, each followed by cardinality information: phone_id 1-1(1), country_code M-1(1), phone_numer M-1(1), and phone_type M-1(0). Three entities appear on the left: store, staff, and customer, connected to the phone entity by three identical relationships. The three relationships are named 'has' and have cardinality 1(0) on both sides.
The diagram uses Sakila naming conventions. Follow the Sakila conventions for your table and column names:
All lower case
Underscore separator between root and suffix
Foreign keys have the same name as referenced primary keyWrite CREATE TABLE and ALTER TABLE statements that:
1. Implement the entity as a new phone table.
2. Implement the has relationships as foreign keys in the Sakila customer, staff, and store tables.
3. Remove the existing phone column from the Sakila address table.Step 2 requires adding a foreign key constraint to an existing table. Ex:
ALTER TABLE customer
ADD FOREIGN KEY (phone_id) REFERENCES phone(phone_id)
ON DELETE SET NULL
ON UPDATE CASCADE;
Specify data types as follows:
phone_id, phone_number, and country_code have data type INT.
phone_type has date type VARCHAR(12) and contains strings like 'Home', 'Mobile', and 'Other'.Apply these constraints:
Learn More
NOT NULL constraints correspond to cardinalities on the diagram above.
Foreign key actions are SET NULL for delete rules and CASCADE for update rules.
Specify a suitable column as the phone table primary key. -
DAT/380 Week 3 LAB 3.12 - Create LessonSchedule table with FK constraints
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 3 LAB 3.12 - Create LessonSchedule table with FK constraints
Two tables are created:
Horse with columns:
ID - integer, primary key
RegisteredName - variable-length stringStudent with columns:
ID - integer, primary key
FirstName - variable-length string
LastName - variable-length stringCreate the LessonSchedule table with columns:
HorseID - integer with range 0 to 65 thousand, not NULL, partial primary key, foreign key references Horse(ID)
StudentID - integer with range 0 to 65 thousand, foreign key references Student(ID)
LessonDateTime - date/time, not NULL, partial primary keyIf a row is deleted from Horse, the rows with the same horse ID should be deleted from LessonSchedule automatically.
If a row is deleted from Student, the same student IDs should be set to NULL in LessonSchedule automatically.
Note: Table and column names are case sensitive in the auto-grader.
CREATE TABLE Horse (
ID SMALLINT UNSIGNED AUTO_INCREMENT,
RegisteredName VARCHAR(15),
PRIMARY KEY (ID)
);CREATE TABLE Student (
ID SMALLINT UNSIGNED AUTO_INCREMENT,
FirstName VARCHAR(20),
LastName VARCHAR(30),
PRIMARY KEY (ID)
);-- Your SQL statements go here
Learn More -
PRG 211 Week 4 Labs
Regular Price: $12.00
Special Price $9.00
PRG 211 Week 4 Labs
Lab 9.1 Output numbers in reverse
Write a program that reads a list of 10 integers, and outputs those integers in reverse. For coding simplicity, follow each output integer by a space, including the last one. Then, output a newline.
Ex: If the input is 2 4 6 8 10 12 14 16 18 20, the output is:
20 18 16 14 12 10 8 6 4 2
To achieve the above, first read the integers into an array. Then output the array in reverse.
Lab 9.2 Middle itemGiven a sorted list of integers, output the middle integer. Assume the number of integers is always odd.
Ex: If the input is 2 3 4 8 11 -1 (a negative indicates end), the output is:
4
The maximum number of inputs for any test case should not exceed 9. If exceeded, output "Too many inputs".Hint: Use an array of size 9. First read the data into an array. Then, based on the number of items, find the middle item.
Lab 9.3 Output values below an amountWrite a program that first gets a list of 5 integers from input. Then, get another value from the input, and output all integers less than or equal to that value.
Ex: If the input is 50 60 140 200 75 100, the output is:
50 60 75
For coding simplicity, follow every output value by a space, including the last one. Then, output a newline.Such functionality is common on sites like Amazon, where a user can filter results.
Learn More -
PRG 211 Week 1 Labs
Regular Price: $15.00
Special Price $12.00
Lab 3.1 Formatted Output Hello World!
Write a program the outputs 'Hello World!'
Lab 3.2 Formatted output: No parking sign.Write a program that prints a formatted "No parking" sign. Note the first line has two leading spaces.
NO PARKING
1:00 - 5:00 a.m.
Lab 3.3 House real estate summarySites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (currentPrice * 0.045) / 12.
Ex: If the input is 200000 210000, the output is:
This house is $200000. The change is $-10000 since last month.
The estimated monthly mortgage is $750.0.
Note: Getting the precise spacing, punctuation, and newlines exactly right is a key point of this assignment. Such precision is an important part of programming.
Lab 3.4 Caffeine levelsA half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-life of about 6 hours in humans. Given caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 18 hours.
Ex: If the input is 100, the output is:
After 6 hours: 50.0 mg
After 12 hours: 25.0 mg
After 18 hours: 12.5 mg
Note: A cup of coffee has about 100 mg. A soda has about 40 mg. An "energy" drink (a misnomer) has between 100 mg and 200 mg.
Lab 3.5 Divide by x.Write a program using integers userNum and x as input, and output userNum divided by x four times.
Ex: If the input is 2000 2, the output is:
1000 500 250 125
Note: In Coral, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded).
Lab 3.6 Driving costs.Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles.
Ex: If the input is 20.0 3.1599, the output is:
1.57995 7.89975 63.198
Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. First use the dollars/gallon and miles/gallon values to calculate the dollars/mile. Then use the dollars/mile value to determine the cost per 10, 50, and 400 miles.Note: Real per-mile cost would also include maintenance and depreciation.
Lab 3.7 Simple statistics.Part 1
Given 3 integers, output their average and their product, using integer arithmetic.Ex: If the input is 10 20 5, the output is:
11 1000
Note: Integer division discards the fraction. Hence the average of 10 20 5 is output as 11, not 11.666666666666666.Submit the above for grading. Your program will fail the test cases (which is expected), until you complete part 2 below but check that you are getting the correct average and product using integer division.
Part 2
Also output the average and product, using floating-point arithmetic.Ex: If the input is 10 20 5, the output is:
11 1000
11.666666666666666 1000.0
Lab 3.8 Using math functionsGiven three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the absolute value of x, and the square root of (xy to the power of z).
Ex: If the input is 5.0 6.5 3.2, the output is:
34938.56214843421 1.2995143401732918e+279 5.0 262.42993783925596
Hint: Coral has built-in math functions (discussed elsewhere) that may be used.
Learn More
Function Behavior Example
SquareRoot(x) Square root of x SquareRoot(9.0) evaluates to 3.0.
RaiseToPower(x, y) Raise x to power y: RaiseToPower(6.0, 2.0) evaluates to 36.0.
AbsoluteValue(x) Absolute value of x AbsoluteValue(-99.5) evaluates to 99.5. -
ITSD424 Unit 3 Famous Favorite Subs
Regular Price: $10.00
Special Price $8.00
ITSD424 Unit 3 Famous Favorite Subs
Continuing from the last assignment.
Assignment DetailsPart 1
Modify your Java application so that it is an easy-to-use GUI application where all of the interaction is performed on one screen. You will now take the individual components and translate them to a single interactive GUI interface using the following GUI components, container, the event listeners, and event subclasses to enhance your application as a more GUI-appropriate interface:
• GUI components
• Container
• Event listeners
• Event subclasses (at least 3–4 utilized)
o ActionEvent
o ItemEvent
o FocusEvent
o KeyEvent
o MouseEvent
o WindowEvent
• ActionPerformed MethodPart 2
Learn More
For this assignment, you are being asked to make sure you are exception handling by verifying that all of the customer-entered information is valid before the order is submitted to ensure order accuracy.
The customer information that the customer must now enter that should be validated includes the following:
• Entered username (must fill in a name)
• Entered at least one sub to order
• Selected all three attributes for sub (such as bread type, sub type, and sub size)
• Entered delivery address that includes street, city, state, and zip code
• Entered telephone number xxx-xxx-xxxx
In this assignment, you are adding in error handling to make sure the customer is filling in all of the required information.
To accomplish this task, you will be utilizing the following Java classes:
• Methods in the character class and StringBuilder class to validate and manipulate characters in a string
• Try.. Catch for the exception handling of all input fields -
PRG/420 Week 5 Java 5.20 LAB: Acronyms
Regular Price: $7.00
Special Price $3.00
PRG/420 Week 5 Java 5.20 LAB: Acronyms
An acronym is a word formed from the initial letters of words in a set phrase. Write a program whose input is a phrase and whose output is an acronym of the input. If a word begins with a lower case letter, don't include that letter in the acronym. Assume there will be at least one upper case letter in the input.
Ex: If the input is Institute of Electrical and Electronics Engineers, the output should be:
IEEEYour program must define and call a method thats returns the acronym created for the given userPhrase.
public static String CreateAcronym(String userPhrase)Hint: Refer to the ascii table to make sure a letter is upper case.
Learn More -
PRG/420 Week 5 Java 5.18 LAB: Flip a coin
Regular Price: $7.00
Special Price $3.00
PRG/420 Week 5 Java 5.18 LAB: Flip a coin
Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than 0.
Ex: If the input is:
3
the output is:
tails
heads
tailsFor reproducibility needed for auto-grading, seed the program with a value of 2. In a real program, you would seed with the current time. In that case, every program's output would be different, which is what is desired but can't be auto-graded.
Note: A common student mistake is to create an instance of Random before each call to rand.nextInt(). But seeding should only be done once, at the start of the program, after which rand.nextInt() can be called any number of times.
Your program must define and call the following method that returns "heads' or 'tails".
Learn More
public static String headsOrTails(Random rand) -
CIS355A Week 4 Lab - Processing Arrays of Objects Stocks4U
Regular Price: $12.00
Special Price $10.00
CIS355A Week 4 Lab - Processing Arrays of Objects Stocks4U
OBJECTIVES
• Create a GUI that uses JList and JTabbedPanes.
• Process multiple objects in an ArrayList.
• Code event handlers for multiple events.PROBLEM: Stocks4U Portfolio Management System
Stocks4U needs to develop an app for you to manage your stock purchases. You should be able to store a list of stock purchases, view the individual stocks, add and remove stocks.FUNCTIONAL REQUIREMENTS
You can code the GUI by hand or use NetBeans GUI builder interface.The GUI should have two tabs using JTabbedPane.
• One tab ("Show stocks") should have
o a JList to display all the stock purchases;
o a text field or label to display information about a particular stock; and
o a JButton to remove a stock.
• One tab ("Add stock") should have textboxes, labels, and a button to input a stock.Create a Stock class to manage the stock activity. It should have private instance variables of
• company name;
• number of shares;
• purchase price; and
• current price.
Create a default and parameterized constructor.
Create sets/gets for all instance variables.
Create a get method to calculate and return the profit or loss. This would be calculated as
Number of shares * (current price – purchase price).
Create toString to display the name of the stock.As you add stocks, they are displayed in the JList.
If you select an element in the JList, the gain or loss is displayed in the label or text field.
If you select an element in the JList and click Remove, the stock is removed from the list.GRADING RUBRIC
Stock class
• Has all required functionality 15
GUI class
• Use the Stock class to process data.
• As you add stocks, they are displayed in the JList.
• If you select an element in the JList, the gain or loss is displayed in the label or text field.
• If you select an element in the JList and click Remove, the stock is removed from the list.
• Use error messages for any invalid/missing user input using JOptionPane. 25
Code style 5
Lab Report 10
TOTAL 55CODE STYLE REQUIREMENTS
• Include meaningful comments throughout your code.
• Use meaningful names for variables.
• Code must be properly indented.
• Include a comment header at beginning of each file, example below.
/****************************************************
Program Name: ProgramName.java
Programmer's Name: Student Name
Program Description: Describe here what this program will do
***********************************************************/DELIVERABLES
Submit as a SINGLE zip folder
• All java files
• Lab reportFollow assignment specification regarding class/method names.
Learn More
Note that your java filename must match class name (DO NOT rename). -
PRG/420 Week 4 Java 4.10 LAB: Middle item
Regular Price: $7.00
Special Price $3.00
PRG/420 Week 4 Java 4.10 LAB: Middle item
Given a sorted list of integers, output the middle integer. Assume the number of integers is always odd.
Ex: If the input is:
2 3 4 8 11 -1
(where a negative indicates the end), the output is:
4The maximum number of inputs for any test case should not exceed 9. If exceeded, output "Too many inputs".
Learn More
Hint: First read the data into an array. Then, based on the array's size, find the middle item.