Create a database to hold a collection of numbers to be searched and sorted:
1) Create a main class and a database class
2) Collect 5 random numbers from the user in the main class and store in an array. (not in ascending or descending order)
3) Create an instance of the database class in your main class and store the numbers array in the database using its constructor.
4) In the Database class, create a method that performs a bubble sort and returns a sorted array of the data (ascending and descending). Call this method from the main class and print the result to the screen.
5) In the Database class, create methods that each return the min, average, and max respectively. Call each of them from the main class and print the result to the screen.
6) In the Database class, create a method that searches for a value in the array using a binary search and returns the index of that value. Call this method from the main class and print the result to the screen.
BubbleSort and Binary Search Code:
{
public static void main(String args[])
{
SortExample ob = new SortExample();
int[] arr = {64, 34, 25, 12, 22, 11, 90};
ob.bubbleSort(arr);
System.out.println("Sorted array");
ob.printArray(arr);
int key = 22;
int index = ob.BinarySearch(arr, key);
System.out.println("\n" + key + " is at index: " + index);
}
void bubbleSort(int[] arr)
{
int n = arr.length;
for (int i = 0; i < n-1; i++)
for (int j = 0; j < n-i-1; j++)
if (arr[j] > arr[j+1])
{
// swap temp and arr[i]
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
/* Prints the array */
void printArray(int arr[])
{
int n = arr.length;
for (int i=0; i<n; ++i)
System.out.print(arr[i] + " ");
System.out.println();
}
int BinarySearch(int[] arr, int key)
{
int mid = 0;
int low = 0;
int high = arr.length - 1;
while (high >= low)
{
mid = (high + low) / 2;
if (arr[mid] < key) {
low = mid + 1;
}
else if (arr[mid] > key) {
high = mid - 1;
}
else {
return mid;
}
}
return -1;
}
}
In: Computer Science
14.19. Suppose that we have the following requirements for a
university database
that is used to keep track of students’ transcripts:
a. The university keeps track of each student’s name (Sname),
student number (Snum), Social Security number (Ssn), current
address (Sc_addr) and phone (Sc_phone), permanent address (Sp_addr)
and phone (Sp_phone), birth date (Bdate), sex (Sex), class (Class)
(‘freshman’, ‘sophomore’, … , ‘graduate’), major department
(Major_code), minor department (Minor_code) (if any), and degree
program (Prog) (‘b.a.’, ‘b.s.’, … , ‘ph.d.’). Both Ssn and student
number have unique values for each student.
b. Each department is described by a name (Dname), department code
(Dcode), office number (Doffice), office phone (Dphone), and
college
(Dcollege). Both name and code have unique values for each
department.
c. Each course has a course name (Cname), description (Cdesc),
cours number (Cnum), number of semester hours (Credit), level
(Level), and offering department (Cdept). The course number is
unique for each course.
d. Each section has an instructor (Iname), semester (Semester),
year (Year), course (Sec_course), and section number (Sec_num). The
section number
distinguishes different sections of the same course that are taught
during the same semester/year; its values are 1, 2, 3, … , up to
the total number of sections taught during each semester.
e. A grade record refers to a student (Ssn), a particular section,
and a grade (Grade).
Design a relational database schema for this database application.
First show all the functional dependencies that should hold among
the attributes. Then design relation schemas for the database that
are each in 3NF or BCNF. Specify the key attributes of each
relation. Note any unspecified requirements, and make appropriate
assumptions to render the specification complete.
Using your DBMS, build this database and populate it with several entities. (Use your imagination)
Using your DBMS, build this database and populate it with several entities. (Use your imagination)
Using your DBMS, build this database and populate it with several entities. (Use your imagination)
Please help me with the set up SQL. thank you
In: Computer Science
You want to test whether salaries have gone up compared to the year 2000. The 2000 Census shows that the average annual salary of all Americans was $35,152. You take an SRS of 10 Americans, ask for their annual salary for the year, and get the following results in thousands of dollars:
| Annual Salary |
| 45 |
| 16 |
| 24 |
| 83 |
| 103 |
| 31 |
| 69 |
| 94 |
| 72 |
| 20 |
A) Determine the population(s) and parameter(s) being discussed.
B) Determine which tool will help us find what we need (one sample z test, one sample t test, two sample t test, one sample z interval, one sample t interval, two sample t interval).
C) Check if the conditions for this tool hold.
D) Whether or not the conditions hold, use the tool you choose in part B. Use C=95% for all confidence intervals and alpha=5% for all significance tests.
* Be sure that all methods end with a sentence describing the results *
In: Statistics and Probability
Value of a Statistical Life (VSL). (a) Describe VSL in terms that a non-economist can understand. (b) Lavetti (2017) studies the wage-risk tradeoff for one of the riskiest professions in the United States, crab fishing in Alaska. The riskiness of crab fishing is driven mainly by the season and weather conditions. Lavetti collects data on the weather conditions of specific fishing trips, and the wages paid to the crew. He then runs a regression of the wage on the expected fatality rate for each trip and finds that an increase in one fatality per 1000 full time workers per year increases the mean hourly wage by $2.10. Calculate the VSL implied by this estimate, assuming that the number of hours a full time worker works in a year is 2000. (c) Does this number seem high or low to you? Briefly discuss why this might be the case.
In: Economics
3. Counting Services Inc. has the following portfolio of trading equity securities at 12/31/18. All securities were purchased during 2018.
Symbol # shares Total Cost Market Value
AAPL 1000 $105,000 $125
BMX 2000 $47,000 $51
CAT 1000 $100,000 $105
GNC 3000 $64,000 $21
Total $316,000
Prepare the adjustment necessary at 12/31/18.
On February 12, 2019, Counting Services sells 1,000 shares of AAPL for $125,000. Prepare the journal entry.
The total cost of the three remaining securities is $211,000 and the market value is (see below) at March 31, 2019. Prepare the adjusting entry.
|
AAPL |
BMX |
CAT |
GNC |
|
$135 |
$55 |
$99 |
$24 |
In: Accounting
|
||||||
|
|
||||||||||
|
In: Accounting
Bigg company is evaluation two projects for next year’s capital budgeting. The after-tax cash flow ($) (including depreciation) are following:
Project A Project B
Year 0 -7500 -17500
Year 1 2000 5600
Year 2 2000 5600
Year 3 2000 5600
Year 4 2000 5600
Year 5 2000 5600
Year 6 4000 9000
If company’s WACC is 13%, find NPV, IRR, Payback and discount payback for each project. If the projects are mutually exclusive what is your recommendation to the company.(show working please)
In: Finance
Exp19_Access_Ch02_Capstone - International Foodies 1.0
Project Description:
International Foodies is an importer of exotic foods from all over the world. You landed a summer internship with the company and discovered that their product lists and the suppliers they buy from are stored in Excel workbooks. You offer to help by using your newly gained knowledge of Access to create a relational database for them. You will begin by importing the workbooks from Excel into a new Access database. Your manager mentions that she would also like a table that specifies food categories so that you can relate the products you sell to specific categories in the database. You will create a table from scratch to track categories, create relationships between the tables, and create some baseline queries.
Steps to Perform:
|
Step |
Instructions |
Points Possible |
|
1 |
Start Access. Open the downloaded Access file named Exp19_Access_Ch2_Cap_Foodies. Grader has automatically added your last name to the beginning of the filename. Save the file to the location where you are storing your files. |
0 |
|
2 |
You will examine the data in the downloaded Excel worksheets to
determine which fields will become the primary keys in each table
and which fields will become the foreign keys so that you can join
them in the database. |
10 |
|
3 |
Import the Products.xlsx workbook, set the ProductID Indexed option to Yes (No Duplicates), and select ProductID as the primary key. Accept the table name Products. |
10 |
|
4 |
Change the Field Size of the QuantityPerUnit field to 25 in Design view of the Products table. Set the Field Size of ProductID and CategoryID to Long Integer. Save the changes and open the table in Datasheet view. Open the Suppliers table in Datasheet view to examine the data. Close the tables. |
4 |
|
5 |
You will create a new table that will enable International
Foodies to associate each product with a food category in the
database. |
6 |
|
6 |
|
6 |
|
7 |
Add CategoryDescription with the Long Text Data Type. Set the Caption property to Category Description. Switch to Datasheet view and save the table when prompted. You will enter Category data into the table in the next step. |
4 |
|
8 |
Category ID Category Name Category Description 1 BEVERAGES SOFT DRINKS, COFFEES, TEAS 2 CONDIMENTS SAUCES, RELISHES, SEASONINGS 3 CONFECTIONS DESSERTS, CANDIES, SWEET BREADS 4 DAIRY PRODUCTS CHEESES 5 GRAINS/CEREALS BREADS, PASTA, CEREAL 6 MEAT/POULTRY PREPARED MEATS 7 PRODUCE DRIED FRUIT, BEAN CURD
8 SEAFOOD SEAWEED
AND FISH |
6 |
|
9 |
You will create the relationships between the tables using the
Relationships window. |
12 |
|
10 |
You will use the Simple Query Wizard to create a query of all
products that you import in the seafood category. |
10 |
|
11 |
Add a criterion in Design view, to include only products with 8 as the CategoryID. |
2 |
|
12 |
Sort the query results in ascending order by ProductName. Run, save, and close the query. |
2 |
|
13 |
You want to create a query that displays actual category names
rather than the CategoryIDs. You are interested to know which meat
and poultry products are imported. You will copy the Seafood
Products query and modify it to delete a field, then add an
additional table and field. |
2 |
|
14 |
Open the Seafood Or Meat/Poultry query in Design view and delete the CategoryIDcolumn. |
2 |
|
15 |
Add the Categories table to the top pane of the query design window. Add the CategoryName field to the last column of the design grid and set the criterion as "Seafood" Or "Meat/Poultry". Run, save, and close the query. |
4 |
In: Computer Science
Details the term Cannibalization, identify two corporations that have dealt with cannibalization and what steps were taken to overcome the cannibalization. Please provide any citations and references. Please be articulate in your responses
In: Chemistry
This is basically about APA Formatting of a paper. As a professional nurse someday, when do you think you will be using citations? What is the significance of this in our profession, Nursing? Write in about 200 words
In: Nursing