Questions
In a well-developed inital post, walk your classmates through the process as you conducted your search....

In a well-developed inital post, walk your classmates through the process as you conducted your search.

Then explain what insights you has as you reviewed the reference page of your source.


In a well-developed post, what is the process of conducting a research on a specific topic.

In: Computer Science

How many key comparisons are made by mergesort in the a. Best case? b. Worst Case?

How many key comparisons are made by mergesort in the

a. Best case?

b. Worst Case?

In: Computer Science

Why would you want to use grouping in a query? Explain.

Why would you want to use grouping in a query? Explain.

In: Computer Science

Use a For loop to compute the sum of all the odd numbers from 1 through...

  1. Use a For loop to compute the sum of all the odd numbers from 1 through 99. Your result should be labeled, and the value should be 2500.
  2. Print your name 7 times using a While loop.
  3. String dogNames[ ] = {"Sam","Buster","Fido","Patches","Gromit","Flicka"};
    Using the array defined here, print the values of the array vertically and horizontally using one For-Each loop.
  4. Reverse the logic for zyBook Challenge activity 4.6.1 (Nested loops: Indent text) so that the first line is indented userNum number of spaces and the subsequent lines are each indented one less space until the last value is not indented at all (‘s’ indicates one space):
    sssss5
    ssss4
    sss3
    ss2
    s1
    0
  5. String method practice:
    • Create a String variable that contains your full name
    • Repeat the following steps 5 times (note you will use predefined String methods to modify your name as indicated):
      • Generate a random number between 1 and 4
      • If number is 1, display your name in all upper case
      • If number is 2, display your name in all lower case
      • If number is 3, replace your first name with “Three” and display your name
      • If number is 4, display the character at index 4

In: Computer Science

Create a class named TestLease whose main() method declares four Lease objects. Call a getData() method...

Create a class named TestLease whose main() method declares four Lease objects. Call a getData() method three times. Within the method, prompt a user for values for each field for a Lease, and return a Lease object to the main() method where it is assigned to one of main()’s Lease objects.

Do not prompt the user for values for the fourth Lease object, but let it continue to hold the default values. Then, in main(), pass one of the Lease objects to a showValues() method that displays the data.

Then call the addPetFee() method using the passed Lease object and confirm that the fee explanation statement is displayed. Next, call the showValues() method for the Lease object again and confirm that the pet fee has been added to the rent.

Finally, call the showValues() method with each of the other three objects; confirm that two hold the values you supplied as input and one holds the constructor default values. Save the application as TestLease.java.

In: Computer Science

SQL This assignment aligns with the following objectives: Create a relational database containing at least three...

SQL

This assignment aligns with the following objectives:

  • Create a relational database containing at least three tables
  • Populate the database using the INSERT command
  • Create integrity constraints on the tables created

Deli has hired you as a consultant to design a database for the deli. They have provided you with the following information:

  • Every employee has a social security number, name, salary, and date of hire.
  • The deli is organized into several departments. Each department has a unique name.
  • Each department has exactly one employee as its manager but an employee may manage more than one department. The database should record the date when the most recent manager of each dept. was appointed in that position.
  • very employee must be assigned a department.
  • Every employee has a supervisor who need not be the manager of any department.

The deli has these four departments:

  1. hot foods
  2. sandwich
  3. snacks
  4. beverage

You are provided the following additional information, which should be inserted into the database using SQL queries (not using any GUI interfaces, such as PhpMyAdmin):

  • Jim Jones (ssn: 134-56-8877, salary: $28,000, dept:hot foods, date of hire: 1/26/2015, supervisor: Rita Bita)
  • Rita Bita (ssn: 138-56-8050, salary: $32,000, dept: beverages, date of hire: 2/15/2017, supervisor: Holly Dew. manages: beverages, starting 3/18/2018)
  • Holly Dew (ssn: 334-55-8877, salary: $29,000, dept:sandwich, date of hire: 1/15/2016, supervisor: Pablo Escobar)
  • Pablo Escobar (ssn: 666-56-6666, salary: $48,000, dept:snacks, date of hire: 1/26/2014, supervisor: Rita Bita, manages: snacks, starting 5/5/2015)
  • Al Capone (ssn: 888-91-8870, salary: $40,000, dept:hot foods, date of hire: 1/26/2015, supervisor: Pablo Escobar, manages: hot foods, starting 1/1/2016)
  • Bonnie Clyde (ssn: 111-22-3333, salary: $42,000, dept: sandwiches, date of hire: 4/7/2015, supervisor: Al Capone, manages: sandwich, starting 1/1/2016)

Helpful Hints:

Please do not assume that the database should be structured in the way this data is provided. Your database should be structured such that constraints such as “Each dept. has exactly one employee as a manager” can be enforced.

There should not be a separate table for Deli – the entire database represents the deli. There should be a table for each major entity mentioned in the specifications. Relations between entities (such as, who works in which department) should be their own tables. Primary keys for each table should be chosen to enforce constraints.

In: Computer Science

There are four basic functions in math. They are addition, subtraction, multiplication and division. Children in...

There are four basic functions in math. They are addition, subtraction, multiplication and division. Children in 1st grade focus on addition. They are required to memorize their addition facts from 1 to 12.

Create a function that prompts the user to enter a number between 1 and 12. Then display - using the input supplied - the addition and subtraction math facts for that number from 1 to 12 for the number entered. The output should be the results of the mathematical calculations.

See below example below:

The user enters "5" as their input. Below is the expected output.

Addition Math Facts for "5"

5 + 1 = 6

5 +2 = 7

...

5 + 11 = 16

5 + 12 = 17

Subtraction Math Facts for "5"

12 - 5 =

11 - 5 =

10 - 5 =

...

7 - 5 = 2

6 - 5 = 1

5 - 5 = 0

* Please note the subtraction facts should stop at the input number - the input number because 1st graders are not prepared to learn about negative numbers.  

If the user enters a number not between 1 and 12, open an alert window stating that it is an invalid number, and prompt them to enter a number again meeting the criteria. Finally, if the number entered is bellow 6, make the background color blue and the text white, if the number is above 6 make the background color red and the text yellow, and if the number is six then make the background color white and the text black.

* must use HTML and java script. Must make program in brackets.

HINT: use a variable and a window.prompt() to store what the person enters, a conditional statement, and string concatenation using HTML .

In: Computer Science

Concert the following 32-bit floating point number (IEEE single precision) into their decimal representation. 1100 0101...

Concert the following 32-bit floating point number (IEEE single precision) into their decimal representation.

1100 0101 0001 1111 1000 0000 0000 0000 (ANSW: -2552.0)

Please show all work

In: Computer Science

How cold is it outside? The temperature alone is not enough to provide the answer. Other...

How cold is it outside? The temperature alone is not enough to provide the answer. Other factors including wind speed, relative humidity, and sunshine play important roles in determining coldness outside. In 2001, the National Weather Service (NWS) implemented the new wind-chill temperature to measure the coldness using temperature and wind speed. The formula is:

twc = 35.74 + 0.6215ta - 35.75v0.16 + 0.4275tav0.16

t w c = 3.74 + 0.6215 t a − 35.75 v 0.16 + 0.4275 t a v 0.16

where ta is the outside temperature measured in degrees Fahrenheit, v is the speed measured in miles per hour, and twc is the wind-chill temperature. The formula cannot be used for wind speeds below 2mph or temperatures below -58°F or above 41°F.

Write a program that prompts the user to enter a temperature between -58°F and 41°F and a wind speed greater than or equal to 2 then displays the wind-chill temperature. Use Math.pow(a, b) to compute v0.16. Your class must be named Windchill. Here is a sample run:

Enter a temperature between -58°F and 41°F: 5.3
Enter the wind speed (>= 2) in miles per hour: 6
The wind chill index is -5.567068455881625

This is what I made:

import java.util.Scanner;
public class Windchill
{
public static void main(String[]args)
{
//create Scanner
Scanner s=new Scanner(System.in);
double ta= 5.3;
int v= 6;
double v2= Math.pow(v,.16);
double Windchill= 35.74 + 0.6215 * ta-35.75 * v2+0.4275 * ta * v2;
//get temperature in Fahrenheit
System.out.println("Enter a temperature between -58°F and 41°F:" +" "+ ta);
//get wind speed
System.out.println("Enter the wind speed (>= 2) in miles per hour"+" "+ v);
//get windchill index
System.out.println("The windchill index is"+" "+ Windchill);
}
}

My teacher told me: "your program needs to let the user enter the temperature and wind speed at the keyboard."

How do I fix this? please help.

In: Computer Science

You coded the following class: public class N extends String, Integer { } When you compile,...

  1. You coded the following class:

public class N extends String, Integer

{

}

When you compile, you get the following message:

N.java:1: ‘{‘ expected

public class N extends String, Integer

                                               ^

1 error

Explain what the problem is and how to fix it.

In: Computer Science

Generating secure password that you can remember, lab2pr0.py It’s not easy to come up with a...

Generating secure password that you can remember, lab2pr0.py It’s not easy
to come up with a secure password that one can actually remember. One of the
methods proposed is to take a line of text and take first letter of each word to form
a password. An extra step is substitute ”o” with 0, ”a” with ”@”, and ”l” with
1. For instance, using ”Cookies and Code, let’s meet on Tuesdays” would yield
”C@C,1m0T”. Write a program that asks the user to enter a phrase and outputs
the password that is generated using these rules.
You can assume that the words in the phrase will be separated by a single space or
a common punctuation sign such as ”.,?!;:” followed by a space.

use python

In: Computer Science

Pizza analysis, lab3pr1.py You noticed that the menu of your favorite pizza chain store is rather...

Pizza analysis, lab3pr1.py You noticed that the menu of your favorite pizza

chain store is rather complicated. They offer a range of pizza size and price op-
tions, making it difficult to see what option offers the most pizza for your dol-
lars. So you decide to write program that calculates the cost per square inch

of a circular pizza, given its diameter and price, similar to how grocery stores
display cost-per-ounce prices. The formula for area is A = r

2 ∗ π. Use two func-
tions: one called area(radius) to compute the area of a pizza, and one called

cost per inch(diameter, price) to compute cost per square inch. Sample runs
of your program should look like this:

Please enter the diameter of your pizza, in inches: 20
Please enter its cost, in dollars: 20
The cost is 0.06 dollars per square inch.
>>>>
Please enter the diameter of your pizza, in inches: 8.5
Please enter its cost, in dollars: 12.99
The cost is 0.23 dollars per square inch.

Use the built-in Python function round(value, 2) to round the final cost-per-
inch value to two decimal points. Use import math and math.pi to get the value

of pi for area computation.

use python

In: Computer Science

This question is about the Hamming distance (HD). Given a reference DNA sequence and a set...

This question is about the Hamming distance (HD).
Given a reference DNA sequence and a set of candidate sequences, you are going to find out which candidate(s) has/have the Hamming distance smaller or equal to a threshold k.
e.g.
Reference DNA: AATGCGC
Candidate 1: AATCCCC
Candidate 2: TTTGCTC
Candidate 3: AATAAAA
If the Hamming distance threshold k = 3:
HD1 = 2
HD2 = 3
HD3 = 4
Your result should return a list of all the qualified candidate numbers and their Hamming distances in format:
[[candidate number, Hamming distance]].
For the result of the example above:
[[1, 2], [2, 3]]
Here begins the question.
Reference sequence: AGAAACTCTCTGGCCTAAAG

Candidate 1: ACTTAGGTCTCTAAGCCCTC
Candidate 2: AGAAACGTTATGTGGACGTT
Candidate 3: AGTCTGACTCTGATCCAAAG
Candidate 4: AGTCTGCCTTGGCCATTAGC
Candidate 5: GTAAGCTAACCCCGCCAGCA
Candidate 6: AGAAACTCTCTTGTCTAAAG
Candidate 7: AGAAATGATGTCGCCTAAAG
Candidate 8: GCGAATGCGACTGGCGAGGT
Threshold = 11.

Submit the codes you have written to solve the previous question (the one of Hamming distance).
If you are using another language other than Python3, please note which language it is.


In: Computer Science

Develop and pseudocode for the code below: #include <algorithm> #include <iostream> #include <time.h> #include "CSVparser.hpp" using...

Develop and pseudocode for the code below:

#include <algorithm>
#include <iostream>
#include <time.h>

#include "CSVparser.hpp"

using namespace std;

//============================================================================
// Global definitions visible to all methods and classes
//============================================================================

// forward declarations
double strToDouble(string str, char ch);

// define a structure to hold bid information
struct Bid {
string bidId; // unique identifier
string title;
string fund;
double amount;
Bid() {
amount = 0.0;
}
};

//============================================================================
// Static methods used for testing
//============================================================================

/**
* Display the bid information to the console (std::out)
*
* @param bid struct containing the bid info
*/
void displayBid(Bid bid) {
cout << bid.bidId << ": " << bid.title << " | " << bid.amount << " | "
<< bid.fund << endl;
return;
}

/**
* Prompt user for bid information using console (std::in)
*
* @return Bid struct containing the bid info
*/
Bid getBid() {
Bid bid;

cout << "Enter Id: ";
cin.ignore();
getline(cin, bid.bidId);

cout << "Enter title: ";
getline(cin, bid.title);

cout << "Enter fund: ";
cin >> bid.fund;

cout << "Enter amount: ";
cin.ignore();
string strAmount;
getline(cin, strAmount);
bid.amount = strToDouble(strAmount, '$');

return bid;
}

/**
* Load a CSV file containing bids into a container
*
* @param csvPath the path to the CSV file to load
* @return a container holding all the bids read
*/
vector<Bid> loadBids(string csvPath) {
cout << "Loading CSV file " << csvPath << endl;

// Define a vector data structure to hold a collection of bids.
vector<Bid> bids;

// initialize the CSV Parser using the given path
csv::Parser file = csv::Parser(csvPath);

try {
// loop to read rows of a CSV file
for (int i = 0; i < file.rowCount(); i++) {

// Create a data structure and add to the collection of bids
Bid bid;
bid.bidId = file[i][1];
bid.title = file[i][0];
bid.fund = file[i][8];
bid.amount = strToDouble(file[i][4], '$');

//cout << "Item: " << bid.title << ", Fund: " << bid.fund << ", Amount: " << bid.amount << endl;

// push this bid to the end
bids.push_back(bid);
}
} catch (csv::Error &e) {
std::cerr << e.what() << std::endl;
}
return bids;
}

// FIXME (2a): Implement the quick sort logic over bid.title

/**
* Partition the vector of bids into two parts, low and high
*
* @param bids Address of the vector<Bid> instance to be partitioned
* @param begin Beginning index to partition
* @param end Ending index to partition
*/
int partition(vector<Bid>& bids, int begin, int end) {

int l = begin;
int h = end;


int pivot = (begin + (end - begin) / 2);
bool finished = false;

// this while loops continually increments the low point as long as it's below the pivot
// then continually decrements the high point as long as it's above the pivot
while(!finished) {

while(bids[l].title.compare(bids[pivot].title) < 0) {
++l;
}

while(bids[pivot].title.compare(bids[h].title) < 0) {
--h;
}

if (l >= h) {
finished = true;
// if variable l is not greater than or equal to h the two bids are swapped
} else {
swap(bids[l] , bids[h]);


//bring end points closer to one another

++l;
--h;
}
}
return h;
}

/**
* Perform a quick sort on bid title
* Average performance: O(n log(n))
* Worst case performance O(n^2))
*
* @param bids address of the vector<Bid> instance to be sorted
* @param begin the beginning index to sort on
* @param end the ending index to sort on
*/
void quickSort(vector<Bid>& bids, int begin, int end) {
}

// FIXME (1a): Implement the selection sort logic over bid.title

/**
* Perform a selection sort on bid title
* Average performance: O(n^2))
* Worst case performance O(n^2))
*
* @param bid address of the vector<Bid>
* instance to be sorted
*/
void selectionSort(vector<Bid>& bids) {
// this creates an index to the smallest minimum bid found
unsigned int smallest;
unsigned int largest = bids.size();

// place designates the position at which bids are sorted/unsorted
for (unsigned place = 0; place < largest; ++place) {
smallest = place;

for (unsigned j = place + 1; j < largest; ++j) {
if (bids[j].title.compare(bids[smallest].title) < 0) {
smallest = j;
}
}

if (smallest != place)
swap(bids[place], bids[smallest]);
}

}

/**
* Simple C function to convert a string to a double
* after stripping out unwanted char
*
* credit: http://stackoverflow.com/a/24875936
*
* @param ch The character to strip out
*/
double strToDouble(string str, char ch) {
str.erase(remove(str.begin(), str.end(), ch), str.end());
return atof(str.c_str());
}

/**
* The one and only main() method
*/
int main(int argc, char* argv[]) {

// process command line arguments
string csvPath;
switch (argc) {
case 2:
csvPath = argv[1];
break;
default:
csvPath = "eBid_Monthly_Sales_Dec_2016.csv";
}

// Define a vector to hold all the bids
vector<Bid> bids;

// Define a timer variable
clock_t ticks;

int choice = 0;
while (choice != 9) {
cout << "Menu:" << endl;
cout << " 1. Load Bids" << endl;
cout << " 2. Display All Bids" << endl;
cout << " 3. Selection Sort All Bids" << endl;
cout << " 4. Quick Sort All Bids" << endl;
cout << " 9. Exit" << endl;
cout << "Enter choice: ";
cin >> choice;

switch (choice) {

case 1:
// Initialize a timer variable before loading bids
ticks = clock();

// Complete the method call to load the bids
bids = loadBids(csvPath);

cout << bids.size() << " bids read" << endl;

// Calculate elapsed time and display result
ticks = clock() - ticks; // current clock ticks minus starting clock ticks
cout << "time: " << ticks << " clock ticks" << endl;
cout << "time: " << ticks * 1.0 / CLOCKS_PER_SEC << " seconds" << endl;

break;

case 2:
// Loop and display the bids read
for (int i = 0; i < bids.size(); ++i) {
displayBid(bids[i]);
}
cout << endl;

break;

// FIXME (1b): Invoke the selection sort and report timing results
    ticks = clock();

// call selectionSort method to sort the loaded bids
selectionSort(bids);

cout << bids.size() << " bids read" << endl;

// Calculate elapsed time and display result
ticks = clock() - ticks; // current clock ticks minus starting clock ticks
cout << "time: " << ticks << " clock ticks" << endl;
cout << "time: " << ticks * 1.0 / CLOCKS_PER_SEC << " seconds" << endl;

break;

// FIXME (2b): Invoke the quick sort and report timing results

   ticks = clock();

// call quickSort method to sort the loaded bids
quickSort(bids, 0, bids.size() - 1);

cout << bids.size() << " bids read" << endl;

// Calculate elapsed time and display result
ticks = clock() - ticks; // current clock ticks minus starting clock ticks
cout << "time: " << ticks << " clock ticks" << endl;
cout << "time: " << ticks * 1.0 / CLOCKS_PER_SEC << " seconds" << endl;

break;

}

cout << "Good bye." << endl;

return 0;
}

In: Computer Science

Implement a simple banking system in Java. Your application should demonstrate the following. Upon running the...

Implement a simple banking system in Java. Your application should demonstrate the following. Upon running the java code, first the application should welcome the user, then ask the user to give one of the options: 1) display the balance summary, 2) withdraw money, or 3) deposit money.

Based on the options your code should perform the following operations such as 1) read the transaction details from a file and display them on the screen. 2) ask the user to enter the amount he wants to withdraw and debit the withdrawal amount from the balance amount. It has to update the file and display the transaction summary. The system should not allow an attempt to withdraw an amount greater than the balance. 3) ask the user to enter the amount he wants to deposit, credit the balance and update the file. It should display the transaction summary.

The records in the file should contain transaction number, transaction type, amount withdrawn, or amount deposited, and balance.
Example:

  1. 1 Deposit 100.0$ 1100.0$

  2. 2 Withdraw 50.0$ 1050.0$

The welcome screen should look like:

Welcome to our Banking System!
Enter your Option in a number: 1. Display balance 2. Deposit amount 3. Withdraw amount
We assume that there is an opening balance of 1000 available in the system (Assign balance=1000.0 in the beginning of the code). Also, while running first start by choosing deposit option or withdraw option.

In: Computer Science