A- Briefly explain what is the purpose of the SW operation in S-DES i.e. How would S-DES be weakened if the SW operation was ommitted.
B- Briefly explain why in DES the key is 56-bits instead of 64-bits?
In: Computer Science
(PYTHON)
A Prime number is an integer greater than 1 that cannot be formed by multiplying two smaller integer other than 1 and itself. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1.
In this question you will write a program that takes a sequence of integers from the user and display all the prime numbers contained in that sequence.
We will separate this question in 2 steps:
Step 1 (5 pts) Write a script that accepts a sequence of positive integer from the user and display all the prime numbers from that sequence. Your program should accept and save in a list the input from the user until the value -1 is entered. Your program should also make sure that only positive values are entered. You can assume the users only enter integers.
Step 2 (5 pts) We can improve the program usability by adding the following functions:
- A function is_prime that receives an integer as parameter, check if this integer is a prime number and returns a boolean value depending on the result. -
A function find_primes that receives the user sequence as parameter and use the function is_prime to figure out which are the prime values. The function then returns a list containing all the prime values contained in the user sequence.
Your user input script should be similar as in part 1 and use the result of the find_primes function to display the list of prime numbers.
In: Computer Science
You have been appointed as a design engineer and
assigned to design a secured network
for a private organization. Evaluate your approach to improve the
security posture of
your network before, during, and after your network
implementation.
In: Computer Science
several trends and issues that are specifically relevant to the field of instructional design and technology.
In: Computer Science
Goal:
After the manager of a local McDonalds hired several ASU grads to work the cash registers, he realized that they were having trouble figuring out the correct amount of change to return to their customers. The manager wants you to create a VB.NET program that calculates the correct amount of change to be given to a customer following a transaction.
Guidelines:
You should have
Inputs:
Transaction Amount
validation: data must have been entered, data must be numeric, amount cannot be negative or greater than $1000.00
Amount of Cash Provided By The Customer
validation: data must have been entered, data must be numeric,
amount cannot be negative and must be equal to or greater than the Transaction Amount
Outputs:
Total Amount of Change To Be Returned
Number of Twenties To Be Returned
Number of Tens To Be Returned
Number of Fives To Be Returned
Number of Ones To Be Returned
Number of Quarters To Be Returned
Number of Dimes To Be Returned
Number of Nickels To Be Returned
Number of Pennies To Be Returned
In: Computer Science
Guidelines
Look up one of the many sites describing the BMI, and read a bit about how it is used to indicate general health. Create a VB.Net program that, given a user’s height in inches and weight in pounds, will calculate and display his/her BMI. After calculating the user's BMI, indicate the user's health status.
BMI = (weight * 703) / (height * height)
Display the user’s Height Status:
BMI |
Health Status |
Below 18.5 |
Underweight |
18.5 -24.9 |
Normal |
25 - 29.9 |
Overweight |
30 & Above |
Obese |
Input: Height and Weight.
Output: BMI (to one decimal, like 27.7) and Weight Status (a string, like “Overweight”)
After the remarks at the top of your program, add “Option Explicit On” and “Option Strict On”. The former requires you to explicitly declare each variable used and the latter requires you to explicitly convert data from one type to another, rather than rely on VB.Net to implicitly convert data.
In: Computer Science
describe how prime numbers or quadratic congruence can be used to crack an encryption system?
In: Computer Science
Does anyone know how to find if a certain String is available in an ArrayList?
I was asked by my instructor to make a certain program about Student Record
In the area where I need to add some student in the ArrayList it won't add if there is the same name in the ArrayList
at first I used the equals method and contains method but later I found it was prohibited to use such method.
Is there a way to find if a String is Available in the ArrayList without using the method
Please check on else if(response==2)
import java.util.*;
public class performanceTask {
public static void main(String[] args) {
int response;
ArrayList<String>
listOfStudent = new ArrayList<String>();
Scanner aScanner = new
Scanner(System.in);
do {
System.out.println("[Selection Bar]");
System.out.println("[1] List of Students.");
System.out.println("[2] Add Student.");
System.out.println("[3] Edit Student.");
System.out.println("[4] Delete Student.");
System.out.println("[5] Clear list of Students.");
System.out.println("[6] Exit Program.");
System.out.println("--------------------------");
System.out.println("Select an option: ");
response =
aScanner.nextInt();
if(response ==
1) {
int size = listOfStudent.size();
if(size == 0) {
System.out.println("No
Records Found!\n");
} else {
Collections.sort(listOfStudent);
for(int i = 0;
i<listOfStudent.size(); i++) {
System.out.println(i + ". " + "[" + listOfStudent.get(i) +
"]");
}
System.out.println("\n");
}
}else if
(response == 2) {
System.out.println("Enter Name of a Student:
");
String addStudent = aScanner.next();
if (listOfStudent.contains(addStudent)) {
System.out.println(addStudent
+" already existed! \n");
} else {
System.out.println("Do you
want to save " + addStudent + "? [y/n]: ");
String saveIt =
aScanner.next();
if(saveIt.equals("y") || saveIt.equals("Y") ) {
listOfStudent.add(addStudent);
System.out.println(addStudent +" has been
successfully added! \n ");
}else if
(saveIt.equals("n") || saveIt.equals("n")) {
System.out.println("\n");
continue;
}else
{
System.out.println("It must be y or n
only!");
}
}
In: Computer Science
1) Convert negative fractional decimal number to 8-bit binary number: – 16.625 (use 2's complement binary format)
Hint: –17 + 0.375
Given the hint above, the fractional number will be divided into
two parts,
- Whole number,
- Fractional part, must be positive
(2) Proof to check that your calculation above is correct
In: Computer Science
Spatial indexing with quadtrees in python
The quadtrees data structure is a special type of tree structure, which can recursively divide a flat 2-D space into four quadrants. Each hierarchical node in this tree structure has either zero or four children. It can be used for various purposes like sparse data storage, image processing, and spatial indexing. Spatial indexing is all about the efficient execution of select geometric queries, forming an essential part of geo-spatial application design. For example, ridesharing applications like Ola and Uber process geo-queries to track the location of cabs and provide updates to users. Facebook’s Nearby Friends feature also has similar functionality. Here, the associated meta-data is stored in the form of tables, and a spatial index is created separately with the object coordinates. The problem objective is to find the nearest point to a given one. You can pursue quadtree data structure projects in a wide range of fields, from mapping, urban planning, and transportation planning to disaster management and mitigation. We have provided a brief outline to fuel your problem-solving and analytical skills. Objective: Creating a data structure that enables the following operations
Insert a location or geometric space
Search for the coordinates of a specific location
Count the number of locations in the data structure in a particular contiguous area
In: Computer Science
SYSTEM RECOVERY
It is highly probable that eventually something bad will happen to your data or your hardware. What can you do to lessen the impact of these problems? You can look at both hardware and software solutions. What is fault tolerance?
In: Computer Science
In: Computer Science
In C++
Circle |
-int x //x coord of the center -int y // y coord of the center -int radius -static int count // static variable to keep count of number of circles created |
+ Circle() //default constructor that sets origin to (0,0) and radius to 1 +Circle(int x, int y, int radius) // regular constructor +getX(): int +getY(): int +getRadius(): int +setX(int newX: void +setY(int newY): void +setRadius(int newRadius):void +getArea(): double // returns the area using formula pi*r^2 +getCircumference // returns the circumference using the formula 2*pi*r +toString(): String // return the circle as a string in the form (x,y) : radius +getDistance(Circle other): double // * returns the distance between the center of this circle and the other circle +moveTo(int newX,int newY):void // * move the center of the circle to the new coordinates +intersects(Circle other): bool //* returns true if the center of the other circle lies inside this circle else returns false +resize(double scale):void// * multiply the radius by the scale +resize(int scale):Circle // * returns a new Circle with the same center as this circle but radius multiplied by scale +getCount():int //returns the number of circles created //note that the resize function is an overloaded function. The definitions have different signatures |
Create "Circle.h"
Create "Circle.cpp"
Complete Main.cpp
#include<iostream>
#include "Circle.h"
#include <fstream>
#include <vector>
#include<cstdlib>
#include <fstream>
#include <sstream>
void inputData(vector<Circle> &circleVector, string
filename){
//create the input string stream called instream
//open file
//if there is a problem opening the file, throw an exception and
exit - use a try catch statement
//otherwise
//use getline to read data line feed to the instream
//create a circle using the data in the instream
//add the circles to the vector
//keep doing this until all the data in the file is read
}
int main(){
cout<<"The number of circles, using getCount method is
"<<//<<endl;
cout<<"The numher of circles, using vetor size method is
"<<//<<endl;
//clear vector
cout<<"The number of circles, using getCount method is
"<<//<endl;
cout<<"The number of circles remaining is ";
return 0;
}
file "dataLab4.txt" contains:
0 0 4
0 0 6
-2 -9 6
4 5 7
7 8 9
In: Computer Science
I'm trying to convert between different number representations in C++ , I have the prototype but im not sure what do do from here
bool convertF(double & x, const string & bits);
bits is supposed to be an 8-bit (not 5-bit) value, each char being '0' or '1'; if not, return
false. The first bit of bits represents the sign bit, the next 3 bits represent the exponent,
and the next 4 bits represent the significand.
convertF may assume without checking that the 3 exponent bits are not all the same.
convertF's job is to set x to the floating-point number that bits represents and return
true.
For example, convertF(x, "101011000") should set x to -7/8 == -0.875
In: Computer Science
# ArrayStack # TODO: push and pop using array stack with doubling technique. import numpy as np from future import print_function # Definisi class ArrayStack class ArrayStack(object): def __init__(self): self.data = np.zeros(20, dtype=np.int) self.count = 0 def isEmpty(self): pass # ubah saya def size(self): pass # ubah saya def push(self, obj): pass # ubah saya def pop(self): pass # ubah saya #-------------------------- # End of class if __name__ == "__main__": stack = ArrayStack() randn = np.random.permutation(1000) for i in range(1000): stack.push(randn[i]) #### for i in range(100): print(stack.pop()) ####
In: Computer Science