The Questions Are of a Organization of Programming course.
A variable can be characterized by a collection of attributes. What is one such attribute? The response is Implicit heap-dynamic allocation. Why is the response that?
Does static type binding require the programmer to specify the type of the variable in the program? Please Explain the answer and why it is the answer.
A certain variable is assigned a value. At that time, new storage is allocated for that variable to fit the new value. What kind of allocation was most likely used? Please provide an answer and please explain why the answer is the answer.
In: Computer Science
In this assignment, students should create five Java classes called Point, Circle, Square, Rectangle, and TestAll, as well as a Java interface called FigureGeometry. The TestAll class should implement the main method which tests all of the other files created in the assignment. After the assignment has been completed, all six files should be submitted for grading into the Dropbox for Assignment 3, which can be found in the Dropbox menu on the course website. Students should note that only the *.java file for each class /interface needs to be submitted; No *.class files need to be submitted into the Dropbox. Please see below specific requirements for the files that must be created and submitted:
Point.java Description:
The Point class should be declared as a public class and should meet all the requirements listed below. Its purpose is to store the Point (width and height) of a two-dimensional, rectangular geometric figure.
Instance Variables:
private int width;//stores the width of a Point object private
private int height;//stores the height of a Point object
Constructor: Point()
Parameters:
int theWidth,
int theHeight
Purpose: initializes the width and height of a Point object in the following manner:
width = theWidth;
height = theHeight;
Methods:
public int getWidth(){//returns the width of a Point object in the following manner
return width;}
public int getHeight(){//returns the height of a Point object in the following manner:
return height;}
public void setWidth(int theWidth){//assigns the width of a Point object as follows:
width = theWidth;}
public void setHeight(int theHeight{//assigns the height of a Point object as follows:
height = theHeight;
}
FigureGeometry.java Description:
The FigureGeometry interface should be declared as a public interface and should meet all the requirements listed below. Its purpose is to declare all the necessary methods that any geometric figure, such as a circle, rectangle, or square, should contain. The FigureGeometry interface should also declare a numeric constant, called PI, which can be used by classes that implement the FigureGeometry interface. Remember that method declarations in an interface should not include modifiers such as public, static, or abstract.
Declaring a method within an interface as static is illegal and will cause a compilation error. Additionally, the declaration of interface methods using public or abstract modifiers is redundant, and soon such declarations will be deprecated. Students should also note that the inclusion of instance variables within an interface declaration is not allowed; only static constants may be defined within an interface declaration, and the use of the static modifier on constants is also redundant. Basically, students should remember one general rule of thumb concerning interface declarations: Only one modifier should be used in an interface declaration--final should be used to declare constants.
public interface FigureGeometry{final float PI = 3.14f;
//Classes that implement the FigureGeometry interface MUST override this method which should return the geometric area of a figure:
//In an interface, methods are always public and abstract. Using these unnecessary modifiers is redundant, and future versions of
//Java may not support them.
float getArea ();
//Classes that implement the FigureGeometry interface MUST also override this method which should return the geometric perimeter of a //figure:
float getPerimeter ();}
Circle.java Description:
The Circle class should be declared as a public class that implements the FigureGeometry interface described above. Its purpose is to store the radius of a circular figure and provide the methods necessary to calculate the area and perimeter of such a figure.
Instance Variables:
private float radius;//stores the radius of a Circle object
Constructor: Circle()
Parameters:
float theRadius;
Purpose:initializes the radius of a Circle in the following manner:
radius = theRadius;
Methods:
1-public float getRadius(){//returns the radius of a Circle object as follows:
return radius;
}
2-public float getArea(){//returns the area of a Circle object as follows:
return getRadius() * getRadius() * PI;
3-public float getPerimeter(){//returns the perimeter of a Circle object as follows:
return getRadius() * 2 * PI;
}
4-public void setRadius(float theRadius){//assigns the radius of a Circle object as follows:
radius = theRadius;
}
The following coding example illustrates a version of the Circle class:
public class Circle implements FigureGeometry{//Stores the radius of this figure:
private float radius;
//Returns the radius of this figure:
public float getRadius (){return radius;}
//Returns the area of this figure:
public float getArea (){
return getRadius() * getRadius() * PI;}
//Returns the perimeter of this figure:
public float getPerimeter (){ return getRadius() * 2 * PI;}
//Assigns the radius of this figure:
public void setRadius (float theRadius){radius = theRadius;
}
}
Square.java Description:
The Square class should be declared as a public class that
implements the FigureGeometry interface and should meet all the
requirements listed below. Its purpose is to store the Point of a
square figure (using the Point class described above and provide
the methods necessary to calculate the area and perimeter of such a
figure.
Instance Variables:
private Point point; //stores the Point of a Square object
Constructor: Square()
Parameters:
Point p;
Purpose:initializes the object point of the Square object in the following manner:
point= p;
Methods:
1-public float getSideLength(){//returns the length of the side of the square as follows:
return point.getWidth();}
2-public float getArea(){//returns the area of a Square object as follows:
return getSideLength() *getSideLength();}
3-public float getPerimeter(){//returns the perimeter of a Square object as follows:
return getSideLength() * 4;}
4-public void setPoint(Point p){//assigns the point of a Square object as follows:
point= p;}
Rectangle.java Description:
The Rectangle class should be declared as a public class that implements the FigureGeometry interface described above. Its purpose is to store the Point of a rectangular figure (using the Point class described above) and provide the methods necessary to calculate the area and perimeter of such a figure.
Instance Variables:
private Point point;//stores the point of the Rectangle object
Constructor: Rectangle()
Parameters:
Point p;
Purpose: initializes the Point of a Rectangle object in the following manner:
point = p;
Methods:
1-public int getWidth()
{//returns the width of a Rectangle object as follows:
return point.getWidth();}
2-public int getHeight()
{//returns the height of a Rectangle object as follows:
return point.getHeight();}
3-public float getArea()
{//returns the area of a Rectangle object as follows:
return getWidth() * getHeight ();}
4-public float getPerimeter()
{//returns the perimeter of a Rectangle object as follows:
return (getWidth+getHeight()) * 2;}
5-public void setPoint(Point p)
{//assigns the point of a Rectangle object as follows:
point = p;}
TestAll.java Description:
The TestAll class should be declared as a public class and should meet all the requirements listed below. Its purpose is to implement a main method which creates three objects--a Circle object, a Square object, and a Rectangle object-- and test each of the files that have been designed above. You should already be familiar with how to instantiate objects and print values to the screen using System.out.println(...). Therefore, the actual implementation code for this assignment will not be provided. You may organize the output of data according to their own specifications. However, the main method must perform the following tasks:
In: Computer Science
MATLAB PROBLEM
convert the for loop to a while loop.
vec= [1 2 3 4 5]
newVec= []
for i=vec
if i>5
new vec=[newvec, i]
end
end
end
In: Computer Science
1. a) Prove that if n is an odd number then 3n + 1is an even number. Use direct proof.
b) Prove that if n is an odd number then n^2+ 3 is divisible by 4. Use direct proof.
2. a) Prove that sum of an even number and an odd number is an odd number. Use direct proof.
b) Prove that product of two rational numbers is a rational number. Use direct proof.
3. a) Prove that if n2is an even number then n is an even number. Use indirect proof.
b) Prove that if n3is an odd number then n is an odd number. Use indirect proof
4. Prove that n2is an even number if and only if 3n + 1 is an odd number by proving
a) If n2is even then 3n + 1 is odd.
b) If 3n + 1 is odd then n^2 is even.
In: Computer Science
**PLEASE ANSWER ALL QUESTIONS**
Ananada is sitting on a train and overhears someone on his phone bragging that he has a massive network of computers at his fingertips that have been compromised with some form of malware. He tells the person on the other end of the call that they can have all these computers attack a target in unison. Which of the following terms might describe the person whose conversation she overheard?
a. |
Bot herder |
|
b. |
Shepherd |
|
c. |
Alien wrangler |
|
d. |
Zombie |
Tyrese has just been hired as a cybersecurity analyst at a major hospital in Colorado. Which of the following regulations might he need to be familiar with?
a. |
ICO |
|
b. |
CCPA |
|
c. |
PIPEDA |
|
d. |
HIPAA |
Albrecht has noticed a number of clients on the network attempting to contact the same external IP address at a constant rate of once every five minutes over the past 72 hours. Which of the following might be the cause of his concern?
a. |
The computers may have formed a distributed computing configuration that allows them to work as a single command and control system. |
|
b. |
The computers are performing a port scan against a victim computer. |
|
c. |
The computers may be infected with malware that has made them part of a botnet. |
|
d. |
The computers are currently taking part in a DDoS attack against the destination IP address. |
In: Computer Science
Python
Write an interactive program for a board game called Parcheesi.
Objective
Develop an interface system using techniques and design patterns seen in class through a problem with realistic constraints.
Specs
put the program output
In: Computer Science
I am just trying to make confNum static so all my classes can use. Can me help with that please.
.h
#include <stdio.h>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include "Customer.hpp"
#include "Employee.hpp"
class BankAccount: public Customer
{
protected:
long AccountNumber;
double Balance;
int confNum;
public:
BankAccount(const string&, const string&, const string&, const string&,long , double, int);//constructor
void setAccountNumber(long);
long getAccountNumber()const;
void setBalance(double);
double getBalance()const;
void setConfNum(int);
int getConfNum();
virtual void deposit(double);
virtual void withdrawl(double);
virtual void writeCheck(double);
virtual void print();
};
#endif /* Bank_Account_hpp */
.cpp
#include "Bank Account.hpp"
#include "Teller.hpp"
double Teller::registerCash;//Static member
BankAccount::BankAccount(const string& first, const string& last, const string& social,const string& IDN,long AccNum, double balance,int num): Customer(first,last,social,AccNum,IDN)
{
setAccountNumber(AccNum);
setBalance(balance);
setConfNum(num);
}
void BankAccount::setAccountNumber(long AccNum)
{
if(AccNum>1000000000 && AccNum<9999999999)
{
AccountNumber=AccNum;
}
}
long BankAccount::getAccountNumber()const
{
return AccountNumber;
}
void BankAccount::setBalance(double balance)
{
if(balance>0)
{
Balance = balance;
}
}
double BankAccount:: getBalance() const
{
return Balance;
}
void BankAccount:: setConfNum(int num)
{
num=(num+1);
confNum=num;
}
int BankAccount::getConfNum()
{
return confNum;
}
void BankAccount::deposit(double amount)
{
Teller::registerCash=amount+Teller::registerCash;
Balance=Balance+amount;
cout<<"The amount of $"<<amount<<" was deposited to the Account #"<<getAccountNumber()<<"."<<endl;
cout<<"The confirmation number: "<< getConfNum()<<"."<<endl<<endl;
}
void BankAccount:: withdrawl(double amount)
{
if(Balance>= amount)
{
Teller::registerCash=Teller::registerCash-amount;
Balance=Balance-amount;
cout<<"The amount of $"<<amount<<" was withdrawn from the Account # "<<getAccountNumber()<<"."<<endl;
cout<<"The confirmation number: "<< getConfNum()<<"."<<endl<<endl;
}
else
{
cout<<"There is not enough money to withdrawl";
}
}
void BankAccount::writeCheck(double amount)
{
if(amount<=Balance)
{
cout<<endl<< "A check was written from the account and the ammount of the check is $"<<amount<<"."<<endl;
withdrawl(amount);
}
else
{
cout<<"There is not enough money available for writing this check"<<endl;
}
}
void BankAccount:: print()
{
cout<<"Bank Account#: "<<getAccountNumber()<<" Balance: $"<< setprecision(2) << fixed << getBalance()<<"."<<endl<<endl;
}
In: Computer Science
Use python to solve
For f (x) = x ln(x), (1) use appropriate Lagrange interpolating polynomial of degree three to approximate f(8.4). Use the following data: f(8.1) = 16.94410, f(8.3) = 17.56492, f(8.6) = 18.50515, f(8.7) = 18.82091. (2) use appropriate Newton interpolation polynomial again to redo the work.
In: Computer Science
Justify
the
following statements
a) Performance
of
the pipelined
processor
increases
with
increase
in the
number of
stages
.
b) Forwarding
can
eliminate
all
possible
stalls
arises
out of
data dependencies
COA ( computer organization and architecture)
In: Computer Science
Instructions
Write a program that prompts the user to enter 50 integers and stores them in an array. The program then determines and outputs which numbers in the array are sum of two other array elements. If an array element is the sum of two other array elements, then for this array element, the program should output all such pairs separated by a ';'.
An example of the program is shown below:
list[0] = 15 is the sum of: ---------------------- list[1] = 25 is the sum of: list[5], list[14]; list[13], list[47]; list[46], list[47]; ---------------------- list[2] = 23 is the sum of: list[0], list[33]; ---------------------- list[3] = 65 is the sum of: list[4], list[32]; list[13], list[20]; list[20], list[46]; list[21], list[34]; list[32], list[38]; ---------------------- list[4] = 34 is the sum of: list[0], list[14]; list[6], list[48]; ---------------------- list[5] = 6 is the sum of: ...
If no two elements can equal the value of an element, the line can remain empty, as shown above for list[0] and list[5].
C++
In: Computer Science
One approach to addressing this problem is to install a more secure data access control problem. The cost of access control software is is $50,000 with 80% effectiveness. Here is the summary of risk and control:
Determine the expected annual costs due to loss and controls. Also, determine whether the costs outweigh the benefits of preventing or mitigating the risks. (5 points)
In: Computer Science
In: Computer Science
Write and Compile a python script to solve the 4-queens problem using. The code should allow for random starting, and for placed starting using numpy
"The 4-Queens Problem[1] consists in placing four queens on a 4 x 4 chessboard so that no two queens can capture each other. That is, no two queens are allowed to be placed on the same row, the same column or the same diagonal."
Display the iterations until the final solution
Arc consistency
In: Computer Science
Design an IP Addressing Scheme; please provide explanation with the answers
Subnet the 192.168.1.0 network into the appropriate number of subnets.
Subnet Number |
Subnet Address |
1st Usable Host Address |
Last Usable Host Address |
Broadcast Address |
In: Computer Science