In: Civil Engineering
Abstract Cart class
import java.util.ArrayList;
import java.util.HashMap;
/**
* The Abstract Cart class represents a user's cart. Items of Type T
can be added
* or removed from the cart. A hashmap is used to keep track of the
number of items
* that have been added to the cart example 2 apples or 4
shirts.
* @author Your friendly CS Profs
* @param -Type of items that will be placed in the Cart.
*/
public abstract class AbstractCart {
protected HashMap cart;
public AbstractCart() {
this.cart = new HashMap();
}
/**
* Calculates the total value of items in the
cart.
* @return total (double)
*/
public abstract double calculateTotal();
/**
* Add an item of type T to the Cart (HashMap: The
product is the key
* and the value is the count).
* If product doesn't exist in the cart add it and set
count to one.
* Otherwise increment the value.
* @param item
* @return boolean
*/
public void addItem(T item) {
//fill in
}
/**
* Adds every item in the Arraylist of Type T or any
subclass of T.
* @param items: An array of items
* @return true if items have been currently
added.
*/
public void addItems(ArrayList items) {
}
/**
* Removes an item of type T from the list.
* If the only one item, we remove that item.
* If item count is greater than one decrement the
count.
* If you are able to remove the item then return
true.
* If the item doesn't exist return false.
* @param item
* @return true
* in the list.
*/
public boolean removeItem(T item) {
//fill in
return true;
}
/**
* Removes all of the item of items of Type T or any
subclass of T from the cart.
* @param item
* @return true if items have been successfully
remove.
*/
public void removeItems(ArrayList items) {
//fill in
}
/**
* Check to see if the cart contains an item.
* @param item
* @return true if cart contains the item. Returns
False otherwize
*/
public boolean contains(T item) {
return
cart.containsKey(item);
}
}
AmazonCart
public class AmazonCart extends AbstractCart {
@Override
/**
* Calculate the total of all the items in the cart
include tax.
* @return total
*/
public double calculateTotal() {
double total = 0.0;
for(AmazonProduct item :
this.cart.keySet()) {
int itemCount =
this.cart.get(item);
total +=
(item.getPrice() + item.calcTax())*itemCount;
}
return total;
}
}
AmazonCartTest
import static org.junit.Assert.*;
import java.util.ArrayList;
import org.junit.Test;
public class AmazonCartTest {
@Test
public void testAddingItemToCard() {
Milk m = new Milk(2.5, "Lactose
Free", false);
AmazonCart amazonCart = new
AmazonCart();
amazonCart.addItem(m);
if(amazonCart.contains(m) != true)
{
fail("Error
AmazonCart-Line-13: Items not currently added to cart");
}
}
@Test
public void testCalculateTotal() {
Milk m = new Milk(3, "Lactose
Free", true);
DVD d = new DVD(10, "Black
Panther", true);
Shirt s = new Shirt(100, "Versace",
false);
AmazonCart amazonCart = new
AmazonCart();
amazonCart.addItem(m);
amazonCart.addItem(d);
amazonCart.addItem(s);
assert(amazonCart.calculateTotal()
== 120.33);
}
@Test
public void testAddingDupplicates() {
Milk m = new Milk(3, "Lactose
Free", true);
DVD d = new DVD(10, "Black
Panther", true);
Shirt s = new Shirt(100, "Versace",
false);
AmazonCart amazonCart = new
AmazonCart();
amazonCart.addItem(m);
amazonCart.addItem(m);
amazonCart.addItem(d);
amazonCart.addItem(d);
amazonCart.addItem(s);
amazonCart.addItem(s);
assert(amazonCart.calculateTotal()
== 240.66);
}
@Test
public void testRemovingItem() {
Milk m = new Milk(3, "Lactose
Free", true);
DVD d = new DVD(10, "Black
Panther", true);
Shirt s = new Shirt(100, "Versace",
false);
AmazonCart amazonCart = new
AmazonCart();
amazonCart.addItem(m);
amazonCart.removeItem(m);
amazonCart.addItem(d);
amazonCart.addItem(s);
amazonCart.addItem(s);
assert(amazonCart.calculateTotal()
== 224.3);
}
@Test
public void testRemovingItem2() {
Milk m = new Milk(3, "Lactose
Free", true);
DVD d = new DVD(10, "Black
Panther", true);
Shirt s = new Shirt(100, "Versace",
false);
AmazonCart amazonCart = new
AmazonCart();
amazonCart.addItem(m);
amazonCart.removeItem(m);
assert(amazonCart.removeItem(d) ==
false);
amazonCart.addItem(d);
amazonCart.addItem(s);
amazonCart.addItem(s);
assert(amazonCart.calculateTotal()
== 224.3);
}
@Test
public void testRemovingItem3() {
Milk m = new Milk(3, "Lactose
Free", true);
DVD d = new DVD(10, "Black
Panther", true);
Shirt s = new Shirt(100, "Versace",
false);
AmazonCart amazonCart = new
AmazonCart();
amazonCart.addItem(m);
amazonCart.addItem(m);
amazonCart.removeItem(m);
amazonCart.removeItem(m);
assert(amazonCart.removeItem(d) ==
false);
amazonCart.addItem(d);
amazonCart.addItem(s);
amazonCart.addItem(s);
assert(amazonCart.calculateTotal()
== 224.3);
}
@Test
public void testAddingArrayListOfItems() {
ArrayList mArray = new
ArrayList<>();
Milk m1 = new Milk(3, "Lactose
Free", true);
Milk m2 = new Milk(2, "Whole Milk",
true);
Milk m3 = new Milk(9.5, "Goats
Milk", true);
mArray.add(m1);
mArray.add(m2);
mArray.add(m3);
AmazonCart amazonCart = new
AmazonCart();
amazonCart.addItems(mArray);
}
@Test
public void testRemovingArrayListOfItems() {
ArrayList mArray = new
ArrayList<>();
Milk m1 = new Milk(3, "Lactose
Free", true);
Milk m2 = new Milk(2, "Whole Milk",
true);
Milk m3 = new Milk(9.5, "Goats
Milk", true);
mArray.add(m1);
mArray.add(m2);
mArray.add(m3);
AmazonCart amazonCart = new
AmazonCart();
amazonCart.addItems(mArray);
amazonCart.removeItems(mArray);
assert(amazonCart.calculateTotal()
== 0);
}
}
In: Computer Science
Java assignment, abstract class, inheritance, and polymorphism.
these are the following following classes:
Animal (abstract)
o Example output: Tom says meow.
Mouse
o Example output: Jerry is chewing on cheese.
Cat
o Example output: Tom is chasing Jerry.
TomAndJerry
Sample run:
Jerry says squeak.
Tom says meow.
Jerry is chewing on cheese.
Tom is chasing Jerry.
In: Computer Science
Please describe this( Encryption technique -abstract and introduction) below Research paper in your Word
Abstract
In network communication system, exchange of data mostly occurs on
networked computers and devices, mobile phones and other internet
based smart electronic gadgets. Importance of network security is
increasing day by day for various network and software applications
in human life. Many of the human activities are automatic and in
future more areas will come as part of networking system. So most
of the end-devices will come to the internet and connect, it is
important to ensure the security of data being transmitted. The
data and network encryption algorithms play a huge role to ensure
the security of data in transmission. In this paper, we provide a
theoretical overview of various encryption techniques, namely those
that range from changes in the position of a letter or word to word
transformations and transposition. These not only provide security
when sending messages, but also security for passwords that are
used to decipher and to encrypt. The conclusions in this study
examine the current theoretical framework,
and propose the usage of methods to prevent online security
breaches
Introduction
Encryption simply means the translation of data blocks into a
secret code which is considered the most effective way to ensure
data security. To read a secret file one must have access to a
secret key that enables to decrypt it. Unsecured data where no
encryption algorithms were used travels through different networks
are open to many types of attacks and can be read, changed or
forged by any attacker who has access to that data or network. To
prevent such attacks encryption and decryption techniques are
employed. Encryption algorithms are used by many software and
network applications, but most of them are not free from
cyber-attacks. Now a days encryption techniques uses algorithms
with a “key” to encrypt data into digital secret code and then
decrypting it by restoring it to its original data. It is important
to protect things like biometric information, email data, medical
records, corporate information, personal data, legal documents,
transactions details from unauthorized access. Encryption
techniques uses a fixed length parameter or key for data
transformation. There are mainly two types of algorithms used to
encrypt data, asymmetric encryption and symmetric encryption. Many
research and analysis of different encryption algorithms such as
DES, 3DES, AES, Blowfish, Twofish, Serpent, RC2, RC5, are going on
which helps to identify the pros and cons of algorithms in various
platforms and application areas. Today's most widely used
encryption algorithms fall into two categories: symmetric and
asymmetric. Symmetric-key ciphers, also referred to as "secret
key," use a single key, sometimes referred to as a shared secret
because the system doing the encryption must share it with any
entity it intends to be able to decrypt the encrypted data. The
most widely used symmetric-key cipher is the Advanced Encryption
Standard (AES), which was designed to protect government
classified information.
Symmetric-key encryption is usually much faster than asymmetric
encryption, but the sender must exchange the key used to encrypt
the data with the recipient before the recipient can perform
decryption on the cipher text. The need to securely distribute and
manage large numbers of keys means most cryptographic processes use
a symmetric algorithm to efficiently encrypt data, but they use an
asymmetric algorithm to securely exchange the secret key. All
securely transmitted live traffic today is encrypted using
symmetric encryption algorithms for example such as live telephone
conversation, streaming video transmission, high speed data link.
Blowfish, AES, RC4,DES, RC5, and RC6 are examples of symmetric
encryption. The most widely used symmetric algorithm is AES-128,
AES-192, and AES-256. In asymmetric key encryption, different keys
are used for encrypting and decrypting a message. Asymmetric
cryptography, also known as public key cryptography, uses two
different but mathematically linked keys, one public and one
private. The public key can be shared with everyone, whereas the
private key must be kept secret. The RSA encryption algorithm is
the most widely used public key algorithm, partly because both the
public and the private keys can encrypt a message; the opposite key
from the one used to encrypt a message is used to decrypt it. This
Attribute provides a method of assuring not only confidentiality,
but also the integrity, authenticity and non reputability of
electronic communications and data at rest through the use of
digital signatures. Diffie-Hellman, RSA, ECC, ElGamal, DSA. The
following are the major asymmetric encryption algorithms used for
encrypting or digitally signing data.
In: Computer Science
1. A good strategy is to write your own documentâ s summary before you compose the main text.
True
False
2. A closing summary appears at the very end of a document, after the concluding section.
True
False
3. Readers always prefer a technical style in summaries.
True
False
4. An effective summary accurately conveys a documentâ s
partial message. | ||
specific details. | ||
essential message. | ||
alternative meanings. | ||
None of these answers are correct. |
5. The best type of abstract for readers who donâ t have time to
read the full report
and who want writers to help guide their thinking is
an informative abstract. | ||
a closing summary. | ||
a descriptive abstract. | ||
an executive abstract. | ||
either b or c. |
6.Instead of a summary, a thesis or topic sentence is usually sufficient to preview the contents of letters and memos.
True
False
7.Never assume that global audiences will understand certain facts that you consider common knowledge.
True
False
8. Ethical pitfalls of summaries include
failing to communicate a documentâ s full complexity. | ||
distorting the message. | ||
too many details. | ||
only a and b. | ||
a, b, and c. |
9.A summary should
never be separated from the main text. | ||
be understandable only after the entire document is read. | ||
be able to stand alone. | ||
a and c. | ||
None of these answers are correct. |
10.The informative abstract
describes the main document and appears just after the title page. | ||
presents the message of the main text and appears just after the title page. | ||
summarizes the full document and appears at the very end. | ||
gives an outline of the document and appears before the title page. | ||
Any of the answers is correct. |
In: Computer Science
It is required to develop an application in Java to perform some operations of a bank. The application will have the following classes:
firstName (String), lastName(String), gender(char), cpr(long), mobile(String) and following methods:
accountHolder(Person), ccountNum(long), balance(double)and following methods:
interestRate(double) and following methods:
In: Computer Science
Question: If a hospital would like to select a good nurse, what would be the types of selection tests needed to choose the candidates: a) Mention the names of only two tests and then b) Mention one reason for choosing each of them; Also what are the types of questions that they may be asked in the interview: c) Give examples of four different types of interview questions (write examples of these sentences). d) Mention one type of interview the hospital should administer in order to interview a large number of nurses quickly
In: Operations Management
1. Mention and briefly explain the advantages and disadvantages of using statistical sampling in a financial statement audit.
2. Mention and briefly explain at what stage or stage of an audit of financial statements the use of statistical sampling could be considered.
In: Accounting
a.) Describe the structure of the GroEL/GroES complex, make sure to mention domains but no need to mention secondary structures involved in the domains (1 pt)
b.) Describe the roles of ATP binding and ATP hydrolysis in GroEL/GroES function.
In: Biology
please write an abstract of the topic "The principles of construction and use of econometric models and methods in economic research"
In: Statistics and Probability