What problems would be solved by moving from virtual machines to containers?
In: Computer Science
Based on the particle example redo the areashapes assignment to implement the polymorphism concept (via method overloading and overriding) whereby the user selects a shape, and the program calculates, and displays the shape's area using "displayArea()" .
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package areashapes;
/**
*
* @author Maore
*/
public class AreaShapes{
public static void main(String[] args) {
Circle c=new Circle();
Triangle t= new Triangle();
Trapezium tz= new Trapezium();
Oval o= new Oval();
System.out.println("Area of the Circle:"+c.area());//single
inheritance
System.out.println("Area of the Triangle is:" + t.area());
System.out.println("Area of the Trapezium is:" + tz.area());
System.out.println("Area of the Oval is:" + o.area());
MethodsRectangle mr=new MethodsRectangle();//method
overloading
//the data type is integer therefore displayArea method will be
invoked.
System.out.println("Area of the Rectangle:"+mr.displayArea(3,
4));
//double data type therefore double type method will be
invoked
System.out.println("Area of the Rectangle:"+mr.displayArea(3.4,
4.3));
//method overriding
Dimensions d=new MethodsRectangle();
d.displayArea();//this will get the method displayArea from the
MethodsRectangle class not from the Dimensions class because it is
overridden by the
//child class
//final keyword
final double unchangeble=1;
System.out.print(unchangeble);
}
}
class Dimensions{ //parent or base class
double radius=7;
double pi= 8;//circle
double length,width;//rectangle
double base,height;//triangle
double a=14,b=16,h=19;//trapezium;
double a1,b1;//oval;
//method override
public void displayArea() {
System.out.print("Display Area");
}
}
//single inheritance
class Circle extends Dimensions{
public double area() {
return (super.pi*super.radius*super.radius);
// super keyword to get the variables of the previous class
}
}
//hierarchical inheritance i.e.,all every class in the program
inheriting the parent class
// Circle class included in this hierarchical inheritance)
class Triangle extends Dimensions{
double base=7;
double height= 8;
public double area() {
return(this.base*this.height);//here we've used this keyword for
access the variable of current class
}
}
class Trapezium extends Dimensions{
public double area() {
return((super.a+super.height)/2)*super.h;//super keyword to access
the variable of current class
}
}
class Oval extends Dimensions{
double a1= 16;
double b1=20;
double pi= 3.14;
public double area() {
return((this.a1*this.b1*this.pi)/2);//this keyword to access the
variable of current class
}
}
//and finally we will look into the method overloading and method
overriding in this class
class MethodsRectangle extends Dimensions{
public int displayArea(int x,int y) {// this method gives area for
integer dimensions
return(x*y);
}
public double displayArea(double x,double y) {
return(x*y);//this method will give area for double type
dimensions
}
public void displayArea() {
System.out.print("\nparent class method overriden by this class
method !!! ");//this method will override the method in Dimensions
class
}
}
In: Computer Science
Write a program in assembly language that outputs the leap years
between a beginning and an ending year.
1. Initialize $a0 and $a1 with the beginning and ending
years.
2. Print out the leap years between 1970 and 2030.
OUTPUT:
From 1970 to 2030:
1972
…
2028
In: Computer Science
In C++, create a class to hold a set of strings called setTree. setTrees contain copies of the strings inserted so that the strings cannot be changed due to the fact that changing the strings inside the set could break the binary search tree. The strings are case sensitive.
TreeSet implements the following:
bool add(const string& s) -- add s to the set, if it's not already there. Return true if the set changed, false otherwise.
void clear() -- remove all elements from the set
bool contains(const string& s) const -- test whether or not s is in the set.
bool isEmpty() const -- test whether or not the set is empty
bool remove(const string& s) -- remove s from the set, if it was there. Return true if the set changed, false otherwise.
int size() const -- return the number of strings in set.
int toArray(string sa[]) const -- put the elements of the set into the array sa. Assume that sa has sufficient room (it's the client's responsibility to check). You can place the strings in any order you choose.
The class also includes a zero-argument constructor to create an empty set, a constructor that takes in an array of strings and its size (creating a set containing each element of the array), copy constructor, assignment operator, and destructor. The copy constructor and assignment operator make deep copies.
setTree implements the set using a binary search tree. The tree does not need to be balanced. The implementation of the tree node class is hidden from the client. There are no memory leaks.
In: Computer Science
Create a file named sales_bonus.py
2. Prompt the user for the amount of sales made, convert to a float, and assign to sales.
3. Prompt the user for number of days missed, covert to an int, and assign to days_missed
4. If the user have more than 3000 of sales and has missed less than or equal to two days of work, assign bonus to 100.
5. Else if the user have more than 3000 of sales or has missed less than or equal to one day of work, assign bonus to 50.
6. Otherwise, assign a bonus of 0.
7. Print out the bonus with two decimal places of precision.
In: Computer Science
What is the limiting factor in determining how many input/output ports a processor can access?
A: the number of bits allocated to a port instruction
B: the number of bits in the port address
C: the number of bits supported by the data bus D:
the number of bits supported by the address bus
E: There are no limiting factors
In: Computer Science
What are semi-weak keys for DES? Assume that the first permutation output of an original key to DES is semi-weak. Describe a possible attack against DES encryption? Does this attack significantly reduce the security of DES? Please justify your answer.
In: Computer Science
Scenario 13‐2: Upgrading a Cluster to Windows Server 2016
As an administrator at the Contoso Corporation, you manage a cluster used as a file server that is running Windows Server 2012 R2. You do not have any other free servers. Describe how to upgrade the cluster to Windows Server 2016.
In: Computer Science
Write a complete main method that does the following:
Takes any number, but at least two, command line arguments which are words (represented as strings) and will print to the console the number of words of length three. (Hint: loop through the args array)
If there are not at least two command line arguments, throw an IllegalArgumentException with an appropriate message.
For ex: Jenna has a new sister: there are 2 words of length three
public class Question1 {
public static void main (String args[]) {
In: Computer Science
Use C language
Write a program that reads in a series of lines of input character by character (using getchar()). The first line of the input contains an integer which specifies the number of remaining lines of input, each of which contains a floating point number. The integer value on the first line can be read with scanf(), but all of the following lines can only be read with getchar(). Each line after the first contains a single floating point value, with up to three digits before the decimal point, and up to three digits following the decimal point (but there is not necessarily a decimal point in each number; i.e., it may appear to be an integer, but the digits should be read by your program, and the number should be converted to a corresponding floating point number). For instance, suppose the following input:
5
3.125
20.25
0.875
921.50
31
The required output is:
Each of the input floating point values, printed on a separate line with three digits of precision, using printf();
On the last line of the output, the string “Total:” followed by the sum of the input values, printed with printf() to 3 digits of precision. For example, the total of the sample input given above is 976.750, so the required output for this input would be:
3.125
20.250
0.875
921.500
31.000
Total: 976.750
Do not concern yourself with small differences in the total due to rounding, as the grader will not deduct points for this.
Be sure to include a descriptive message for the user to input the values correctly. You can assume that the user will follow your directions (which should be consistent with the description above), so no exception handling for incorrect input is required. You cannot change the input specifications given above, however.
CONSTRAINTS:
You are not allowed to use arrays on this portion of the lab assignment.
You must use getchar() to read in the floating point values one character at a time (i.e. DO NOT USE scanf()).
-Only use printf() to output the floating point numbers and the total (Do not useputchar()).
Be sure your directions to the user are clear so they are sure to enter the input data correctly.
In: Computer Science
1) Please find and share one sorting/searching algorithm. Explain it, and discuss its efficiency
2) Please find and share algorithm about red/black trees. Explain it, give 2 real world usages and discuss its efficiency
3) Please find and share one algorithm about Binary Search Trees. Explain it, and discuss it's efficiency
In: Computer Science
Explain advantages and disadvantages of using kafka streams VS elastic search.
In: Computer Science
Recursion Part
//1. Write out the output for eaching of following:
/* Consider this function.
void myMethod( int counter)
{
if(counter == 0)
return;
else
{
System.out.println(""+counter);
myMethod(--counter);
return;
}
}
This recursion is not infinite, assuming the method is passed a positive integer value. What will the output be?
b. Consider this method:
void myMethod( int counter)
{
if(counter == 0)
return;
else
{
System.out.println("hello" + counter);
myMethod(--counter);
System.out.println(""+counter);
return;
}
}
If the method is called with the value 4, what will the output be? Explain.
c.
public class Recursion {
public static void mystery1(int a, int b) {
if (a <= b) {
int m = (a + b) / 2;
System.out.print(m + " ");
mystery1(a, m-1);
mystery1(m+1, b);
}
}
public static void mystery2(int n) {
if (n > 0) {
System.out.print(n + " ");
mystery2(n-2);
mystery2(n-3);
System.out.print(n + " ");
}
}
public static void mystery3(int n) {
if (n == 0 || n == 1) return;
mystery3(n-2);
System.out.print(n + " ");
mystery3(n-1);
}
public static String mystery4(int n) {
if (n <= 0) return "";
return mystery4(n-3) + n + " " + mystery4(n-2) + n + " ";
}
public static void main(String[] args) {
int N = 5;
mystery1(0, N);
System.out.println();
mystery2(N);
System.out.println();
mystery3(N);
System.out.println();
System.out.println(mystery4(N));
}
}
In: Computer Science
write a simple program to explain vector type in
c++...
use comments to explain plz
In: Computer Science
The following code has some syntax error. Please fixed the error. Besides, I want the output in ASCII characters. Please give me the corrected code along with the screenshot of the output.
def cbc_dec(ys):
int xs = []
int iv = ("0XAA", 16) #in decimal
int key = ("0X08", 16)
int x0 = chr(((163 * (int (ys[0], 16) - key)) % 256) ^ iv)
xs.append(x0)
for i in range (1, len(ys)):
int xi = chr((( 163 * (int (ys[i], 16) - key)) %256) ^ int (ys[i-1], 16))
xs.append(xi)
return xs
def main():
cipher_cbc = ["0XA0", "0XCC", "0X1F","0XE3','0XE0','0X59']
ps_cbc = cbc_dec(cipher_cbc)
print("\nCBC decryption", ps_cbc)
main()
In: Computer Science