Provide examples of best practice and poor practice from your own experience of website design and justify your thinking with evidence.
In: Computer Science
Directions Create a class that computes the lift and drag of a rectangular planform wing. Lift can be calculated with the following equation: lift = Cl * A * 0.5 * rho * V2 Cl is the lift coefficient; it is dimensionless A is the area of the wing in m2 rho is the air density, in kg/m3 , for the altitude the wing is flying V is the velocity in m/s Drag can be calculated with the following equation: Drag = Cd * A * 0.5 * rho * V2 Cd is the drag coefficient; it is dimensionless The other variables are the same as the lift equation. Notes: Cl and Cd vary with the wing angle of attack. rho varies with altitude. A rectangular planform wing is 85% efficient when compared to the optimal elliptical wing.
In: Computer Science
**SAP Project Manager
**Ten sentences for each points
In: Computer Science
Design and implement a functional traffic light using a push button to act as a cross walk. Components one RGB LED Lights, two 330 ohm resistor, POT, Temperature Sensor, Arduino, and a bread board Description: Use a POT and a Temperature Sensor to enable the Red and Green Legs of and RGB LED. RGB LEDs have three legs the (R)ed, (G)reen and (B)leu legs. c programming language
In: Computer Science
In: Computer Science
Question: State if an algorithm (satisfying the formal definition of an algorithm) which is guaranteed to find a solution exists or not for each of the following problems by filling the blanks with “Yes” (an algorithm guaranteed to find a solution exists) or “No” (an algorithm guaranteed to find a solution does not exist).
1. Finding the average height of a person in a group, given the height of each person in the group
2. Finding all factors of a finite integer
3. Finding if a triangle is scalene or not, when the coordinates of its vertices are given
4. Finding a path from the given start location to the given goal location in a finite maze (the number of junctions is finite and the length of path connecting any two junctions is also finite) that changes unpredictably at any time
In: Computer Science
Please write queries based on the following requirements using DML In-Class Data Set. For each question, you are required to submit 1) SQL query code; 2) a screen shot of your query result.You should copy and paste your SQL query code to the word document instead of taking a screenshot of your code. Missing either part for each question will result in 0 for this question.
8.List the warehouse number and the average unit price for warehouses other than number 2.
9.List the stored part information for SG parts stored in warehouse 2 or 3.
10.List the part number and part description for each part with letter D(or d) in the part_description. Rank your results in ascending order on itemclass and then descending order on units_on_hand.
11.List the average unit price among all the parts. Rename the column as AVG_UNIT_PRICE
12.List the part number and part description for each part with nine characters or ten characters in the part_description. Rank your results in ascending order on part number.
13.Find the itemclasses and the number of parts under each class. Only show those classes with at least3 types of parts.
14.List the stored part information for SG parts or parts with more than 60 units stored in warehouse 3.
15.List the number of different part stored in each warehouse, only include those warehouse with at most3parts.
In: Computer Science
Part 2. Monty Hall problem:
Given below is the description of the problem.
Suppose you're on a game show and you're given the choice of three doors.
Behind one door is a car; behind the others, goats. The car and the goats were placed randomly behind the doors before the show.
The rules are:
After you have chosen a door, the door remains closed for the time being. The game show host, Monty Hall, who knows what is behind the doors, now has to open one of the two remaining doors, and the door he opens must have a goat behind it. If both remaining doors have goats behind them, he chooses one randomly.
After Monty opens a door with a goat, he will ask you to decide whether you want to stay with your first choice or to switch to the last remaining door. Imagine that you chose Door 1 and the host opens Door 3, which has a goat. He then asks you "Do you want to switch to Door Number 2?" Is it to your advantage to change your choice?
NOTES:
In: Computer Science
10.13 LAB*: Warm up: Online shopping cart (Part 1)
(1) Create three files to submit:
Build the ItemToPurchase class with the following specifications:
(2) In main(), prompt the user for two items and create two
objects of the ItemToPurchase class. Before prompting for the
second item, call cin.ignore() to allow the user
to input a new string. (2 pts)
Ex:
Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10
(3) Add the costs of the two items together and output the total
cost. (2 pts)
Ex:
TOTAL COST Chocolate Chips 1 @ $3 = $3 Bottled Water 10 @ $1 = $10 Total: $13
code ---------------------------------------------------------
#include <iostream>
using namespace std;
#include "ItemToPurchase.h"
int main() {
/* Type your code here */
return 0;
}
In: Computer Science
Explain the OSI model with examples of each layer.
In: Computer Science
Write a C++ program to test if a given array satisfies the constraints of min heap and max heap.
bool isMinHeap(int arr[],int size); bool isMaxHeap(int arr[],int size);
Also write code for this function:-
int heapPlay(int arr[],int size);
The function returns an integer as follows:-
1. If the array is a min heap return the minimum element
2. If the array is a max heap return maximum element
3. Return 0, if the array is a min heap and a max heap
4. Return -1, if the array is neither a min heap nor a max heap
Ex.
Input - Contains size on line 1, an array on line 2.
Output - We will test your three methods
Input -
3
1 2 3
Output -
isMinHeap -> true
isMaxHeap -> false
heapPlay -> 1
Sample Input 1:
1 5
Sample Output 1:
1 1 0
Sample Input 2:
3 9 8 7
Sample Output 2:
0 1 9
template:
bool isMinHeap(int arr[],int size)
{
//code here
}
bool isMaxHeap(int arr[],int size)
{
//code here
}
int heapPlay(int arr[],int size)
{
//code here
}
In: Computer Science
Write a C++ program, tictac.cpp, that repeatedly reads in tic-tac-toe boards and for each one indicates if there is a winner and who won.
The board will be read in as 3x3 array of characters (x, o or . for a blank spot).
You are required to write the following functions to help solve the problem:
// input prompts the user for a board and inputs it
// into the given array
void input (char board [3][3]);
// print prints the board in nice format
void print (char board [3][3]);
How it should look:
Enter your board as characters (x, o or .):
o.x
..o
.x.
The board is:
o | | x
-----------
| | o
-----------
| x |
No winner!
Would you like to do another (y or n)? y
Enter your board as characters (x, o or .):
oxo
ox.
.xo
The board is:
o | x | o
-----------
o | x |
-----------
| x | o
X wins!
Would you like to do another (y or n)? y
Enter your board as characters (x, o or .):
xoo
xox
ox.
The board is:
x | o | o
-----------
x | o | x
-----------
o | x |
O wins!
Would you like to do another (y or n)? n
Thanks for playing!
// win returns true if the given player has won on the
// given board, else it returns false
bool win (char board [3][3], char player);
You are required to use nested loops to write the functions input and print.
The back of this page shows a sample run of the program (input in bold). Your output should look at least as nice as that shown. You may assume that the board will be legal and there will be at most one winner.
In: Computer Science
Program a calculator or computer to use Euler's method to compute y(1), where y(x) is the solution of the given initial-value problem. (Give all answers to four decimal places.)
dy/dx+ 3x2y = 12x2,
y(0) = 5
| h = 1 | y(1) = |
| h = 0.1 | y(1) = |
| h = 0.01 | y(1) = |
| h = 0.001 | y(1) = |
In: Computer Science
c++
1 city.h
#pragma once
#ifndef CITY_H
#define CITY_H
#include<string>
#include<iostream>
#include<utility>
using namespace std;
class City {
public:
City(string nm, unsigned int pop) {
namePopulationPair = make_pair(nm, pop);
}
bool operator<(const City &city)const {
if (this->getName() < city.getName()) {
return true;
}
else {
return false;
}
}
void setName(string name) { namePopulationPair.first = name; }
void setPopulation(unsigned int population)
{
namePopulationPair.second = population;
}
string getName() const { return namePopulationPair.first; }
unsigned int getPopulation() const { return namePopulationPair.second; }
virtual void printInfo() const {
cout << getName() << ": " << getPopulation() << endl;
}
protected:
pair<string, unsigned int> namePopulationPair;
};
#endif
Use city.h from the previous lab without any modifications.
2 main.cpp
In main.cpp do the following step by step:
1. Globally define array cityArray[] consisting of cities with the following details:
(a) Los Angeles with population of 4 million
(b) San Diego with population of 1.5 million
(c) San Francisco with population of 900 thousand
(d) Sacramento with population of 500 thousand
(e) Stockton with the population of 300 thousand
(f) Redding with the population of 90 thousand
(g) Las Vegas with the population of 700 thousand
(h) Reno with the population of 300 thousand
(i) Portland with the population of 700 thousand
(j) Seattle with the population of 750 thousand
(k) Eugene with the population of 200 thousand
2. Globally define a vector of City objects, without initial values. Call it cityVector (1 points).
3. Pass vectors to these functions as reference, and define them as constant if the functions are not
allowed to modify them.
(a) Define function void initVector(...) that receives a vector of City objects, an array
of elements of type City as a second input, and an integer as its third input. The third input
represents the number of elements in the input array. Initialize the input queue with the elements
existing in the input array (2 points).
(b) Define function void printCityVector(...) that receives a vector of City objects
as input and prints the elements within the vector. Hint: You can use range-based for loops (2
points).
(c) Define function int mergeCityVector(...) that receives a vector of City objects as
input, along with three integers as indexes that represent the lower bound, the division point of
the vector into two halves, and the upper bound within the vector. It merges the two halves of
the vector (assuming they are sorted) according to the city populations (5 points).
(d) Define function void cityMergeSort(...) that receives a vector of City objects as
input, along with two integers as indexes that represent the lower and upper boundaries within
the vector. It does merge sort on the vector of City objects according to the city populations
(by invoking the mergeCityVector() function on sorted vectors (5 points).
In main() function do the following step by step, using the functions defined above:
(i) Initialize cityVector according to array cityArray[] using the function defined above (1
points).
(ii) Print out the entries of cityVector, using the appropriate function defined above (1 points).
(iii) Do merge sort on cityVector and print out the updated vector. (1 points).
The output of the program may look like the following:
Initializing cityVector with cityArray[]:
Los Angeles: 4000000
San Diego: 1500000
San Francisco: 900000
Sacramento: 500000
Stockton: 300000
Redding: 90000
Las Vegas: 700000
Reno: 300000
Portland: 700000
Seattle: 750000
Eugene: 200000
Merge sort on cityVector:
Redding: 90000
Eugene: 200000
Stockton: 300000
Reno: 300000
Sacramento: 500000
Las Vegas: 700000
Portland: 700000
Seattle: 750000
San Francisco: 900000
San Diego: 1500000
Los Angeles: 4000000
2
In: Computer Science
write a simple python program that takes in 6-50 random numbers the user types in and then guesses the next 6 of numbers that will be produced based on the numbers entered. it's something like a lottery program. You can use any algorithm you want but it has to be in the python programming language.
Thank you!
In: Computer Science