Which of the following team is responsible for mapping solutions with process flow? pick one
Production Support and Monitoring Team
Business Excellence Team
Scripting Team
Scripting and Operations Team
In: Computer Science
import math import numpy as np import numpy.linalg from scipy.linalg import solve A = np.array([[-math.cos(math.pi/6),0, math.cos(math.pi/3),0, 0, 0], [-math.sin(math.pi/6), 0, -math.sin(math.pi/3), 0, 0, 0], [math.cos(math.pi/6), 1, 0, 1, 0, 0], [math.sin(math.pi/6), 0, 0, 0, 1, 0], [0, -1, -math.cos(math.pi/3), 0, 0, 0], [0, 0, math.sin(math.pi/3), 0, 0, 1]]) b = np.array([0, 2000, 0, 0, 0, 0])
x = [0, 0, 0, 0, 0, 0] def seidel(a, x, b): # Finding length of a(3) n = len(a) # for loop for 3 times as to calculate x, y , z for j in range(0, n): # temp variable d to store b[j] d = b[j] # to calculate respective xi, yi, zi for i in range(0, n): if (j != i): d -= a[j][i] * x[i] # updating the value of our solution x[j] = d / a[j][j] # returning our updated solution return x seidel(A, x, b)
RESULTS:
:\Users\mauri\Anaconda3\python.exe
"C:/Users/mauri/PycharmProjects/OCEN 261 APPLIED NUMERICAL
METHODS/HW 7.py"
C:/Users/mauri/PycharmProjects/OCEN 261 APPLIED NUMERICAL
METHODS/HW 7.py:75: RuntimeWarning: divide by zero encountered in
double_scalars
x[j] = d / a[j][j]
C:/Users/mauri/PycharmProjects/OCEN 261 APPLIED NUMERICAL
METHODS/HW 7.py:73: RuntimeWarning:
PLEASE HELP MEND MY GAUSS-Seidel Code
In: Computer Science
Web Server Infrastructure
Web application infrastructure includes sub-components and external applications that provide efficiency, scalability, reliability, robustness, and most critically, security.
Use the graphic below to answer the following questions:
Stage 1 |
Stage 2 |
Stage 3 |
Stage 4 |
Stage 5 |
Client |
Firewall |
Web Server |
Web Application |
Database |
In: Computer Science
Which of these tasks do you think is most feasible for automation? Pick one
Issuing handwritten memos for clients
Reading scanned copies of documents
Recruiting new employees
Sending daily status report emails
In: Computer Science
For the following program segments, write a program that shows the estimated runtime for each piece. Run it on your computer when n=1, 10, 100, 1000, 10000, 100000, 1000000 for ten times each so that you can observe the differences in performance among these segments.
Segment1: for (sum=0, i=1; i<=n; i++)
sum = sum + i;
Segment2: for (sum=0, i=1; i<=n; i++)
for (j=1; j<=i; j++)
sum++;
Segment3: sum= n * (n+1)/2
In: Computer Science
Loops
Write a simple C/C++ console application that will calculate the equivalent series or parallel resistance. Upon execution the program will request ether 1 Series or 2 Parallel then the number of resisters. The program will then request each resistor value. Upon entering the last resistor the program will print out the equivalent resistance. The program will ask if another run is requested otherwise it will exit.
In: Computer Science
The human resources department for your company needs a program that will determine how much to deduct from an employee’s paycheck to cover healthcare costs. Health care deductions are based on several factors. All employees are charged at flat rate of $150 to be enrolled in the company healthcare system. If they are married there is an additional charge of $75 to cover their spouse/partner. If they have children, the cost is $50 per child. In addition, all employees are given a 10% deduction in the total cost if they have declared to be a “non-smoker”.
Your goal is to create a program that gathers the employee’s name, marital status, number of children and whether or not they smoke tobacco for a single employee. While gathering this information, if the user enters at least one invalid value, the program must display one error message telling the user they made a mistake and that they should re-run the program to try again. The program must then end at this point. However, if all valid values are entered, the program should calculate the total cost of the healthcare payroll deduction and then print a well-formatted report that shows the employee’s name, marital status, total number of children, and smoker designation, and total deduction amount.
Write a well-documented, efficient Java program that implements the algorithm you identified. Include appropriate documentation as identified in the documentation expectations document. Note: You must use the JOptionPane class for input/output. Additionally, if you use System.exit as shown in the textbook, it may only be used as the absolute last line in the program. You may not use System.exit, or any variant that exits the program in the middle of the program. The program should be designed to only exit once the algorithm has finished.
In: Computer Science
Write a Python function next_Sophie_Germain(n), which on input a positive integer n return the smallest Sophie Germain prime that is greater or equal to n.
In: Computer Science
This is the header file:
#ifndef __HW2_H__
#define __HW2_H__
// Previous two lines are the start of the marco guard
// Try not to change this file
#include <iostream>
#include <cmath>
using std::cout;
using std::endl;
using std::istream;
using std::ostream;
class Point {
private:
double x, y, z;
public:
// Constructors
Point();
Point(double inX, double inY, double inZ = 0);
Point(const Point& inPt);
// Get Functions
double getX() const;
double getY() const;
double getZ() const;
// Set Functions
void setX(double inX);
void setY(double inY);
void setZ(double inZ);
void setXY(double inX, double inY);
void setXYZ(double inX, double inY, double inZ);
// Member Functions
void print();
double distance();
double distance(const Point& pt2) const;
bool origin();
bool line(Point pt2);
Point cross(Point pt2);
// Friend functions
friend istream& operator>>(istream& ins,
Point& target);
friend ostream& operator<<(ostream&
outs, const Point& source);
};
// Overloading Functions
Point operator+(const Point& pt1, const Point& pt2);
Point operator-(const Point& pt1, const Point& pt2);
// Non-Member Functions
bool plane(const Point pts[], const Point& target);
bool square(const Point pts[], const size_t size);
Point centroid(const Point pts[], const size_t size);
// Following line is the end of the marco guard
#endif
This is the implementation file I wrote so far:
#include "hw2.h"
#include<iostream>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<cstdlib>
// Put your functions/prototype here
using namespace std;
Point::Point(){
x=0; y=0; z=0;
}
Point::Point(double inX, double inY, double inZ=0){
x=inX;
y=inY;
z=inZ;
}
Point::Point(const Point& inPt){
x=inPt.x;
y=inPt.y;
z=inPt.z;
}
void Point::setX(double inX){ x=inX}
void Point::setY(double inY){y=inY}
void Point::setZ(double inZ){y=inZ}
void Point::setXY(double inX, double inY){
x=inX;
y=inY;
}
void Point::setXYZ(double inX, double inY, double inZ){
x=inX;
y=inY;
z=inZ;
}
double Point::getX(){return x;}
double Point::getY(){return y;}
double Point::getZ(){return z;}
void Point::print(){
cout<<"("<<getX()<<","<<getY()<<","<<getZ()<<")"<<endl;
}
double Point::distance(){
return sqrt((x*x)+(y*y)+(z*z));
}
double Point::distance(const Point& pt2) const{
return
sqrt((x-pt2.x)*(x-pt2.x)+(y-pt2.y)*(y-pt2.y)+(z-pt2.z)*(z-pt2.z));
}
bool Point::origin(){
if(x==0&&y==0&&z==0)
return true;
else
return false;
}
bool Point::line(Point pt2){
I need help with question 11,12,13, and 14 from the following:
Name your implementation file as LastName(3 to 5
letters)_FirstNameInitial_HW1.cpp
Note: You can only use iostream, cassert, cmath, cstdio, and
cstdlib.
Create a class called Point with the following:
1. Private members: x, y and z as double.
2. Write a default constructor and set the point to (0, 0,
0).
3. Write a constructor and set the point to user input, if z is not
inputted, set it to 0.
4. Write a copy constructor.
5. Write the set functions for each individual member, x and y
together, and x, y, and z
together.
6. Write the get functions for each individual member.
7. Write a member function called print() that print out the point
as (x, y, z)\n.
8. Write a member function called distance() that return the
distance between the origin and
the point.
9. Write a member function called distance(param) that return the
distance between a pt2
and the point.
10. Write a member function called origin() that return true if the
point is the origin.
11. Write a member function called line(param) that return
true if pt2 is on the same line as
the origin and the point. Otherwise, return false. Also return
false if the origin and the
point do NOT make a line.
12. Write a member function called cross(param) that return a point
that is the cross product
of a pt2 and the point.
13. Overload the addition (+) and the subtraction (-)
operators.
14. Overload the output (<<) and input (>>) operators.
The output should be (x, y, z)\n.
15. Write a non-member function called plane(param) that takes an
array of exactly three
points and a target point. Return true if the target point is on
the plane created by the
static array of three points. Otherwise, return false.
To find the plane
i. Find u and v where u is pt2-pt1 and v is pt3-pt1.
ii. Find the normal vector to the plane by using the cross product
of u and v.
iii. Using the Point-Normal Form, the normal vector, and any of the
three
points, the equation of the plane is a(x-x 0 ) + b(y-y 0 ) + (cz-z
0 ) = 0, where
<a, b, c> is the normal vector and P(x 0 , y 0 , z 0 ) is one
of the three points.
Thus, any points P(x, y, z) that satisfy this equation is on the
plane.
16. Write a non-member function called square(param) that takes a
static array of unique
points and the size of the array. Return true if the array of
points can create at least one
square. Otherwise return false.
17. Write a non-member function called centroid(param) that takes a
static array of points
and the size of the array and return the centroid of the array of
points. If there is no
center, return the origins.
In: Computer Science
1)
What's the result of calling method blitz passing strings "Aquamarine" as the first argument and "Heliotrope" as the second argument?
static int blitz(String v, String w) { if (v.length() != w.length()) return 0; int c = 0; for (int i = 0; i < v.length(); i++) if (v.charAt(i) == w.charAt(i)) c++; return c; }
a)0
b)1
c)2
d) 3
2)What is NOT an advantage of dynamic arrays compared to static arrays?
a)new elements can be added
b)elements can be inserted
c)elements can be individually indexed
d)elements can be removed
3)
Consider the following code segment:
ArrayList<Integer> scores = new ArrayList<>();
scores.add(5);
scores.add(8);
scores.add(1);
scores.add(1, 9);
scores.remove(2);
scores.add(0, 2);
What's the content of array scores after the code is executed?
a)[2, 5, 8, 1]
b)[2, 5, 9, 1]
c)[5, 2, 9, 1]
d) something else
4)
Consider the following code segment:
int mat[][] = new int[4][3]; for (int i = 0; i < mat.length; i++) for (int j = 0; j < mat[0].length; j++) if (i % 2 == 0) mat[i][j] = 2; else if (i % 3 == 0) mat[i][j] = 3; else mat[i][j] = 0;
What is the content of mat's 3rd row after the code segment is executed?
a)[3, 3, 3, 3]
b)[3, 3, 3]
c)[2, 2, 2, 2]
d)[2, 2, 2]
In: Computer Science
The concept that all data and transactions on the Internet must be treated equally is called _______________________________.
A. |
Moore's Law |
|
B. |
ISP Equality |
|
C. |
Net Neutrality |
|
D. |
Service-oriented Architecture |
In: Computer Science
change the do while by using while or any other way
public void read_input(){
int x,y;
int pop;
Scanner sc = new Scanner(System.in);
do {
System.out.print("Enter X and Y for city 1: ");
x = sc.nextInt();
y = sc.nextInt();
} while ((x < 1 || x > 25) || (y < 1 || y > 25));
setCity1(x,y);
System.out.print("Enter population for city 1: ");
pop = sc.nextInt();
setPop1(pop*1000);
do {
System.out.print("Enter X and Y for city 2: ");
x = sc.nextInt();
y = sc.nextInt();
} while ((x < 1 || x > 25) || (y < 1 || y > 25));
setCity2(x,y);
System.out.print("Enter population for city 2: ");
pop = sc.nextInt();
setPop2(pop*1000);
do {
System.out.print("Enter X and Y for city 3: ");
x = sc.nextInt();
y = sc.nextInt();
} while ((x < 1 || x > 25) || (y < 1 || y > 25));
setCity3(x,y);
System.out.print("Enter population for city 3: ");
pop = sc.nextInt();
setPop3(pop*1000);
do {
System.out.print("Enter X and Y for city 4: ");
x = sc.nextInt();
y = sc.nextInt();
} while ((x < 1 || x > 25) || (y < 1 || y > 25));
setCity4(x,y);
System.out.print("Enter population for city 4: ");
pop = sc.nextInt();
setPop4(pop*1000);
}
In: Computer Science
Need a description what does this program does and how does it work.
#include <iostream>
using namespace std;
double function(int num, double* memorize);
int main()
{
int num=5;
char cont;
double* memorize = new double[num + 1];
do {
cout << "Enter n ";
cin >> num;
memorize[1] = 1;
memorize[2] = 1;
memorize[3] = 1;
memorize[4] = 3;
memorize[5] = 5;
for (int i = 6; i <= num; i++)
memorize[i] = -1; // -1 means that the value is not in the array
cout << num << "th number: " << function(num, memorize) << endl;
cout << "Continue?";
cin >> cont;
cout << endl;
} while (cont == 'y' || cont == 'Y');
delete[] memorize;
return 0;
}
double function(int num, double* memorize)
{
// checks if value was calculated before
if (memorize[num] == -1)
{
// recursively calculates said value and stores it in
memorize[num] = function(num - 1, memorize) + (3 * function(num - 5, memorize));
}
return memorize[num];
}
In: Computer Science
Given the class Date that can prints the date in numerical form. Some applications might require the date to be printed in another form, such as October 1, 2020. Please do the following:
public class Date
{
private int dMonth; //variable to store the month
private int dDay; //variable to store the day
private int dYear; //variable to store the year
//Default constructor
//Data members dMonth, dDay, and dYear are set to
//the default values
//Postcondition: dMonth = 1; dDay = 1; dYear = 1900;
public Date()
{
dMonth = 1;
dDay = 1;
dYear = 1900;
}
//Constructor to set the date
//Data members dMonth, dDay, and dYear are set
//according to the parameters
//Postcondition: dMonth = month; dDay = day;
// dYear = year;
public Date(int month, int day, int year)
{
setDate(month, day, year);
}
//Method to set the date
//Data members dMonth, dDay, and dYear are set
//according to the parameters
//Postcondition: dMonth = month; dDay = day;
// dYear = year;
public void setDate(int month, int day, int year)
{
if (year >= 1)
dYear = year;
else
dYear = 1900;
if (1 <= month && month <= 12)
dMonth = month;
else
dMonth = 1;
switch (dMonth)
{
case 1: case 3: case 5: case 7:
case 8: case 10: case 12: if (1 <= day && day <=
31)
dDay = day;
else
dDay = 1;
break;
case 4: case 6:
case 9: case 11: if (1 <= day && day <= 30)
dDay = day;
else
dDay = 1;
break;
case 2: if (isLeapYear())
{
if (1 <= day && day <= 29)
dDay = day;
else
dDay = 1;
}
else
{
if (1 <= day && day <= 28)
dDay = day;
else
dDay = 1;
}
}
}
//Method to return the month
//Postcondition: The value of dMonth is returned
public int getMonth()
{
return dMonth;
}
//Method to return the day
//Postcondition: The value of dDay is returned
public int getDay()
{
return dDay;
}
//Method to return the year
//Postcondition: The value of dYear is returned
public int getYear()
{
return dYear;
}
//Method to return the date in the form mm-dd-yyyy
public String toString()
{
return (dMonth + "-" + dDay + "-" + dYear);
}
public boolean isLeapYear()
{
if ((dYear % 4 == 0 && dYear % 100 != 0) || (dYear % 400 ==
0))
return true;
else
return false;
}
public void setMonth(int m)
{
dMonth = m;
}
public void setDay(int d)
{
dDay = d;
}
public void setYear(int y)
{
dYear = y;
}
public int getDaysInMonth()
{
int noOfDays = 0;
switch (dMonth)
{
case 1: case 3: case 5:
case 7: case 8: case 10: case 12: noOfDays = 31;
break;
case 4: case 6: case 9: case 11: noOfDays = 30;
break;
case 2: if (isLeapYear())
noOfDays = 29;
else
noOfDays = 28;
}
return noOfDays;
}
public int numberOfDaysPassed()
{
int[] monthArr = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int sumDays = 0;
int i;
for (i = 1; i < dMonth; i++)
sumDays = sumDays + monthArr[i];
if (isLeapYear() && dMonth > 2)
sumDays = sumDays + dDay + 1;
else
sumDays = sumDays + dDay;
return sumDays;
}
int numberOfDaysLeft()
{
if (isLeapYear())
return 366 - numberOfDaysPassed();
else
return 365 - numberOfDaysPassed();
}
public void incrementDate(int nDays)
{
int[] monthArr = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int daysLeftInMonth;
daysLeftInMonth = monthArr[dMonth] - dDay;
if (daysLeftInMonth >= nDays)
dDay = dDay + nDays;
else
{
dDay = 1;
dMonth++;
nDays = nDays - (daysLeftInMonth + 1);
while (nDays > 0)
if (nDays >= monthArr[dMonth])
{
nDays = nDays - monthArr[dMonth];
if ((dMonth == 2) && isLeapYear())
nDays--;
dMonth++;
if (dMonth > 12)
{
dMonth = 1;
dYear++;
}
}
else
{
dDay = dDay+nDays;
nDays = 0;
}
}
}
public void makeCopy(Date otherDate)
{
dMonth = otherDate.dMonth;
dDay = otherDate.dDay;
dDay = otherDate.dDay;
}
public Date getCopy()
{
Date temp = new Date();
temp.dMonth = dMonth;
temp.dDay = dDay;
temp.dYear = dYear;
return temp;
}
}
In: Computer Science
>>> words('example.txt')
['The', '3', 'lines', 'in', 'this', 'file', 'end', 'with', 'the', 'new', 'line', 'character', 'There', 'is', 'a', 'blank', 'line', 'above', 'this', 'line']
In: Computer Science