In: Computer Science
Consider a simple system with 8-bit block size. Assume the encryption (and decryption) to be a simple XOR of the key with the input. In other words, to encrypt x with k we simply perform x⊕k giving y. Similarly, to decrypt y, we perform y⊕k giving x.
You are given the following 16-bit input 1A2Bin hexadecimal. You are provided IV as 9D in hexadecimal. The key to be used (where appropriate) is 7C in hexadecimal. Compute the encrypted output with the following methods. Express your final answer, for each of them, as 4 hexadecimal characters so it is easy to read.
A. ECB
B. CBC
C. OFB
D. CFB
In: Computer Science
Assignment
Examine the Main and Address classes. You are going to add two classes derived from Address: BusinessAddress and PersonAddress.
Create BusinessAddress class
The printLabel method should print (using System.out.println())
First line – the businessName field
Second line – the address2 field if it is not null or empty
Third line – the StreetAddress field if it is not null or empty
Fourth line – city field followed by a comma and space, the state field followed by two spaces, and the zip field
Create PersonAddress class
The printLabel method should print (using System.out.println())
First line – the personName field
Second line – the StreetAddress field
Third line – city field followed by a comma and space, the state field followed by two spaces, and the zip field
Modify Main class
Add the following three BusinessAddress objects to the list.
|
BusinessName |
Address2 |
StreetAddress |
City |
State |
Zip |
|
Columbus State |
Eibling 302B |
550 East Spring St. |
Columbus |
OH |
43215 |
|
AEP |
P.O. Box 2075 |
null |
Columbus |
OH |
43201 |
|
Bill’s Coffee |
null |
2079 N. Main St. |
Columbus |
OH |
43227 |
Add the following three PersonAddress objects to the list.
|
PersonName |
StreetAddress |
City |
State |
Zip |
|
Saul Goodman |
1200 N. Fourth St. |
Worthington |
OH |
43217 |
|
Mike Ehrmentraut |
207 Main St. |
Reynoldsburg |
OH |
43211 |
|
Gustavo Fring |
2091 Elm St. |
Pickerington |
OH |
43191 |
Example Output
Columbus State
Eibling 302B
550 East Spring St.
Columbus, OH 43215
====================
AEP
P.O. Box 2075
Columbus, OH 43201
====================
Bill's Coffee
2079 N. Main St.
Columbus, OH 43227
====================
Saul Goodman
1200 N. Fourth St.
Worthington, OH 43217
====================
Mike Ehrmentraut
207 Main St.
Reynoldsburg, OH 43211
====================
Gustavo Fring
2091 Elm St.
Pickerington, OH 43191
====================
My code
package home;
public class Main {
public static void main(String[] args) {
Address[] addressList = new Address[6];
// TODO Add 3 person addresses to list
addressList[3] = new PersonAddress("1200 N. Fourth St.","Worthington","OH","43217","Saul Goodman");
addressList[4] = new PersonAddress("207 Main St.","Reynoldsburg","OH","43217","Mike Ehrmentraut");
addressList[5] = new PersonAddress("2091 Elm St.","Pickerington","OH","43191","Gustavo Fring");
// TODO Add 3 business address to list
addressList[0] = new BusinessAddress("550 East Spring St.","Columbus","OH","43215","Columbus State","Eibling 302B");
addressList[1] = new BusinessAddress(null,"Columbus","OH","43201","AEP","P.O. Box 2075");
addressList[2] = new BusinessAddress("2079 N. Main St.","Columbus","OH","43227","Bill’s Coffee",null);
for (Address address : addressList) {
address.printLabel();
System.out.println("====================");
}
}
}
package home;
public class BusinessAddress extends Address {
// two private String fields businessName and address2
private String businessName;
private String address2;
//Constructor
public BusinessAddress(String streetAddress, String city, String state, String zip, String businessName, String address2) {
super(streetAddress, city, state, zip);
this.businessName = businessName;
this.address2 = address2;
}
//getters and setters
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getAddress2() {
return address2;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
@Override
public void printLabel() {
String result ="";
if(address2==null)
result = businessName+"\n"+super.toString();
else
result = businessName+"\n"+address2+"\n"+super.toString();
System.out.println(result);
}
}
}
package home;
public class PersonAddress extends Address {
private String personName;
//Constructor
public PersonAddress(String streetAddress, String city, String state, String zip, String personName) {
super(streetAddress, city, state, zip);
this.personName = personName;
}
//getter and setter
public String getPersonName() {
return personName;
}
public void setPersonName(String personName) {
this.personName = personName;
}
@Override
public void printLabel() {
System.out.println(personName+"\n"+super.toString());
}
}
package home;
public abstract class Address {
private String streetAddress;
private String city;
private String state;
private String zip;
public Address(String streetAddress, String city, String state, String zip) {
this.streetAddress = streetAddress;
this.city = city;
this.state = state;
this.zip = zip;
}
public String getStreetAddress() {
return streetAddress;
}
public void setStreetAddress(String streetAddress) {
this.streetAddress = streetAddress;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String toString() {
return streetAddress + "\n" +
city + ", " + state + " " + zip + "\n";
}
public abstract void printLabel();
}In: Computer Science
write the outline pseudocode (code is also allowed) for the following problem...
Catherine wants to simulate a lottery game. What steps would this require?
Imagine that Catherine wants a computer to simulate a lottery game. The computer will be generating two-digit numbers. Each time the computer generates a number, the user is first invited to guess what the number is. If the user guesses the exact number, the award is 10 000 EUR. If the user makes a correct guess on one of the digits, and on the right place, the award is 3 000 EUR. If the user guesses correctly that a digit was selected, but not which position it is in, the award is 100 EUR.
Examples:
Computer: 96: Computer: 47: Computer: 42:
User: 96 User: 43 User: 29
Award Award Award
10 000 EUR 3 000 EUR
100 EUR
Catherine’s algorithm and program can follow the below-mentioned steps:
Step 1: The computer generates a random two-digit number.
Step 2: The user makes a guess of what the number is and enters it through the keyboard.
Step 3: The computer compares the two numbers and evaluates whether the user wins anything.
Step 4: The computer displays the number that was generated in
step 1.
Step 5: the computer displays a message of whether the user wins
something, as suggested
above.
Step 6: The computer repeats the procedure from step 1 to step 5. The game is played 3 times.
In: Computer Science
Discuss how SQL Nexus assist in developing proper hypothesis for performance issues? 2. What recommendations do you provide a novice DBA for using SQL Nexus?
In: Computer Science
C++
Assume you need to test a function named inOrder. The function inOrder receives three int arguments and returns true if and only if the arguments are in non-decreasing order: that is, the second argument is not less than the first and the third is not less than the second. Write the definition of driver function testInOrder whose job it is to determine whether inOrder is correct. So testInOrder returns true if inOrder is correct and returns false otherwise.
. For the purposes of this exercise, assume inOrder is an expensive function call, so call it as few times as possible!
In: Computer Science
What makes a good tool for analyzing and interpreting data? And why? Give an example.
In: Computer Science
C# Programming
1. Create an Employee class with two fields: idNum and hourlyWage. The Employee constructor requires values for both fields. Upon construction, thrown an ArgumentException if the hourlyWage is less than 7.50 or more than 50.00. Write a program that establishes, one at a time, at least three Employees with hourlyWages that are above, below, and within the allowed range. Immediately after each instantiation attempt, handle any thrown Exceptions by displaying an error message. Save the file as EmployeeExceptionDemo.cs.
2. Write an application that creates an array of five Employees. Prompt the user for values for each field for each Employee. If the user enters improper or invalid data, handle any exceptions that are thrown by setting the Employee’s ID number to 999 and the Employee’s pay rate to the $7.50. At the end of the program, display all the entered, and possible corrected, records. Save the file as EmployeeExceptionDemo2.cs.
In: Computer Science
Read the following pseudocode class definitions:
Class Plant
Public Module message()
Display "I'm a plant."
End Module
End Class
Class Tree Extends Plant
Public Module message()
Display "I'm a tree."
End Module
End Class
Given these class definitions, determine what the following pseudocode will display:
Declare Plant p
Set p = New Tree()
Call p.message()
Discuss how algorithms address object-oriented classes and objects.
In: Computer Science
This is the question about the java problem, please give the detail comment and code of each class.
Please write tests for all the code of all the classes
Thank you
Create a class Mammal with the following UML
diagrams:
+---------------------------------+
| Mammal |
+---------------------------------+
| - name: String |
+---------------------------------+
| + Mammal(String name) |
| + getName(): String |
| + isCookable(): boolean |
| + testMammal(): void | (this method is static
)
+---------------------------------+
The isCookable method of the
Mammal class returns a boolean indicating whether
the mammal can be cooked or not: some mammals can be cooked and
some mammals cannot be cooked so for safety reasons the
isCookable method just prints a message
"Do not cook this!" and returns false (because the
isCookablemethod must return a boolean).
Add a class Human to your program. A human is a
mammal. The constructor for the Human class takes
no argument. All humans are named "Alice" and
humans cannot be cooked (the isCookable method
must not print any message though, it simply returns
false).
Add a class Rabbit to your program. A rabbit is a
mammal. The Rabbit class has a private instance
variable weight of type double
that describes the weight of the rabbit, and a
getWeight method. The constructor for the
Rabbit class takes the rabbit’s name and the
rabbit’s weight as arguments. A rabbit can be cooked.
Add a class EuropeanRabbit to your program.
European rabbit is a species of rabbit. The
EuropeanRabbitclass has two constructors: the
first constructor takes the European rabbit’s name and the European
rabbit’s weight as arguments; the second constructor only takes the
European rabbit’s name as argument and always uses
2.0 as the European rabbit’s weight. The second
constructor must use the first constructor.
Add a class LapinSautéChasseur to your program.
Lapin sauté chasseur is a kind of European rabbit. The constructor
for the LapinSautéChasseur class takes no
argument. Lapin sauté chasseur is always named
"Delicious" and has a weight of 0.5.
Add a class FrankTheRabbit to your program. Frank
The Rabbit is a kind of rabbit. The constructor for
theFrankTheRabbit class takes no argument. Frank
The Rabbit is always named "Frank", has a weight
of 100.0, and cannot be cooked.
Add a class Start to your program to test all your
classes.
Question 2
Add a class CastIronPot to your program with the
following UML diagram:
+---------------------------------+
| CastIronPot |
+---------------------------------+
| - rabbit: Rabbit |
+---------------------------------+
| + CastIronPot(Rabbit rabbit) |
| + getRabbit(): Rabbit |
| + testCastIronPot(): void |(this method is
static)
+---------------------------------+
In the testCastIronPot method, create a lapin
sauté chasseur called lsc1, then create a cast
iron pot with this lapin sauté chasseur in it. Then get the lapin
sauté chasseur from the cast iron pot and store it into a local
variable called lsc2 of type
LapinSautéChasseur. Use the == operator to check
that lsc1 and lsc2 are the same
lapin sauté chasseur.
In: Computer Science
A javafx gui that's meant to work like a shopping cart, which has 3 books how did this happen 12.99, will benelli, 14.99, and where do I go, 10.99, you can remove from cart, clear cart, or checkout, and it should have a receipt of what you purchased. I am using eclipse, thanks.
In: Computer Science
What is the difference between a comma-delimited text file and a fixed-width text file? Why is it important that you understand the difference before you import data from a text file?
In: Computer Science
What are the advantages and disadvantages of saving a workbook template to a folder other than the Templates folder?
In: Computer Science
The following code is for a class named Box. The class Box includes a constructor method Box, and a method getVolume().
For your assignment you are to develop a java class named MatchBox. Your class MatchBox must extend the class Box and in addition to the attributes width, height, and depth that are defined in the class Box, MatchBox must add a new attribute weight. The getVolume method must both report the values of width, height, depth, and weight, but must also calculate and report the volume by multiplying height by width by depth. The class MatchBox must also add the method calculateWeight() that will calculate weight based upon the volume assuming that the volume is a quantity of water which weighs .03611 pounds per cubic inch. Also method calculateWeight should show the result like this: weight of MatchBox is X.
For example a car class can inherit some properties from a General vehicle class. Here we find that the base class is the vehicle class and the subclass is the more specific car class. A subclass must use the extends clause to derive from a super class which must be written in the header of the subclass definition. The subclass inherits members of the superclass and hence promotes code reuse. The subclass itself can add its own new behavior and properties.
Your new class must include a main method that creates a new MatchBox object, calls the getVolume method and reports the results by printing the following items to the screen (where the X is replaced by the calculated value) For your assignment, assume that the value of width is 5, height is 10, and the depth is 3. The output should look like the following with X replaced with the appropriate calculated value.
width of MatchBox is X
height of MatchBox is X
depth of MatchBox is X
weight of MatchBox is X
Volume is: X
Helpful Hints
When creating this assignment you should assume a java file for each component. First create a Box.java to hold the box class, a MatchBox.java for the MatchBox class and a main.java for the main routine. All three files, when using Netbeans must belong to the same package so make sure you use the package statement at the beginning of each file.
Keep in mind that in the new class MatchBox, you can either use the methods and variables in the Box class, redefine methods or variables for the MatchBox class that exist in Box or create new methods and variables.
======
The class Box is as follows:
class Box {
double width;
double height;
double depth;
// This is an empty constructor
Box() {
;
}
Box(double w, double h, double d) {
width = w;
height = h;
depth = d;
}
void getVolume() {
System.out.println("Volume is : " + width * height * depth);
}In: Computer Science
Using Object Oriented Programming method, make a simple game program with C++. Please include fully explanation/diagram(if any) about which parts implement the object oriented programming.
In: Computer Science