Questions
Look at Stock and StockDriver. Get these programs to run. We will be keeping track of...

Look at Stock and StockDriver. Get these programs to run. We will be keeping track of both our cost and the fair market value of our shares of stock.

import java.text.*;

public class Stock {

   // this line is used to output money but this is NOT considered a field
   NumberFormat money = NumberFormat.getCurrencyInstance();

   // create five fields - a String called stockName, a integer called custID
   // a integer called numShares, a double named costPaid,and a double called currentValue
   // Do not forget the access modifier
   public String stockName;
   public int custID;
   public int numShares;
   public double costPaid;
   public double currentValue;
       // create an empty and full constructor
  
   public Stock()
   {
   }
  
   public Stock(String s, int c, int n, double co, double cv)
   {
       stockName = s;
       custID = c;
       numShares = n;
       costPaid = co;
       currentValue = cv;
   }
   public String toString() {
       return custID + " owns " + numShares + " shares of " + stockName
               + " worth " + money.format(currentValue) + " per share. You paid "+
               money.format(costPaid) + " per share.";
   }

   // write a calcCost method that takes no parameters and returns a double
   // Have it return the total cost you paid for the stock
  
   // write a method named calcCurrentValue that takes no parameters and returns a double
   // that is the current value of the stock.

   // write your getters and setters. You should at least once try to create
   // these by hand so you understand them
   // (even though Eclipse will write these for you)
   // (DO NOT create one for money - it really is not a field)
}

import java.text.*;
import java.util.*;
public class StockDriver {

   public static void main(String[] args) {
      
       boolean more = true;
      
       Scanner scan = new Scanner(System.in);
       NumberFormat money = NumberFormat.getCurrencyInstance();
      
       while (more)
       {
           /* NOTE : in the next four comments, you will need two lines per comment
           one for the prompt and one for the answer. Make certain your choice
           of data types for each is the same as the associated field in Stock*/
          
           // ask for the Customer ID and store the answer in the variable named custNum
           // ask for the name of the stock and store the answer in the variable named type
           // ask for the number of shares and store the answer in the variable named num
           // ask for how much was paid per share and store the answer in the variable named paid
           // ask for the current value per share and store the answer in the variable named current
          
          
          
           // create a Stock instance named stock by calling the full constructor
          
           // call the calcCost method on the stock instance (-- NOTE - this is in the Stock class!!)
           //   and store the answer in the double variable grossAmt
          
           // call the calcCurrentValue method on the stock instance and store the answer in the double
           // variable named currentAmt
          
          
           // print out the toString() method on the stock instance
          
          
           System.out.println("The total cost of the stock is " + money.format(grossAmt) +
                   " and the current value is " + money.format(currentAmt));
                  
           System.out.println ("More stocks to calculate? (true or false)");
           more = scan.nextBoolean();              
          
       }

      
   }
         
}

Sample output:

Customer id: 1234

Name of stock: IBM

Number of shares: 200

Price paid per share: 60.00

Current value per share: 65.00

1234 owns 200 shares of IBM worth $65.00 per share. You paid $60.00 per share.

The total cost of the stock is $12,000.00 and the current value is $13,000.00

More stocks to calculate? (true or false)

true

Customer id: 3434

Name of stock: GOOG

Number of shares: 120

Price paid per share: 45.00

Current value per share: 120.00

3434 owns 120 shares of GOOG worth $120.00 per share. You paid $45.00 per share.

The total cost of the stock is $5,400.00 and the current value is $14,400.00

More stocks to calculate? (true or false)

false

In: Computer Science

Case study adapted from: [Brooks hear. ICT Services Management (Custom Edition EBook), Pearson Education Australia, 2015....

Case study adapted from: [Brooks hear. ICT Services Management (Custom Edition EBook), Pearson Education Australia, 2015. ProQuest Ebook Central, http://ebookcentral.proquest.com] Reusable Passwords The most common authentication credential is the reusable password, which is a string of characters that a user types to gain access to the resources associated with a certain username (account) on a computer. These are called reusable passwords because the user types the password each time he or she needs access to the resource. Unfortunately, the reusable password is the weakest form of authentication, and it is appropriate only for the least sensitive assets. Ease of Use and Low Cost: The popularity of password authentication is hardly surprising. For users, passwords are familiar and relatively easy to use. For corporate IT departments, passwords add no cost because operating systems and many applications have built-in password authentication. Dictionary Attacks The main problem with passwords is that most users pick very weak passwords. To break into a host by guessing and trying passwords, hackers often use password dictionaries. These are lists of passwords likely to succeed. Running through a password dictionary to see if a password is accepted for a username is called a dictionary attack. Password dictionaries typically have three types of entries: a list of common password, the words in standard dictionaries, and hybrid versions of words such as capitalizing the first letter and adding a digit at the end. If a password is in one of these dictionaries, the attacker may have to try a few thousand passwords, but this will only take seconds. No password that is in a cracker dictionary is adequately strong, no matter how long it is. Fortunately, good passwords cannot be broken by dictionary attacks. Good passwords have two characteristics. First, they are complex. It is essential to have a mix of upper and lower case letters that does not have a regular pattern such as alternating uppercase letters lowercase letters. It is also good— and some would say necessary— to include non-letter keyboard characters such as the digits (0 through 9) and other special characters (&, #./,?, etc.). If a password is complex, it can only be cracked by a brute-force attack, in which the cracker first tries all combinations of one character passwords, all combinations of two-character passwords, and so forth, until the attacker finds one that works. Complexity is not enough, however. Complex passwords must also be long. For short complex passwords, brute force attacks will still succeed. Beyond about 10 or 12 characters, however, there are too many combinations to try in a reasonable period of time. Overall, while long complex passwords can defeat determined attacks, most users select passwords that can be cracked with dictionary attacks. Reusable passwords are no longer appropriate in an era when password cracking programs can reveal most passwords in seconds or minutes. Passwords are only useful for non-sensitive assets.

Answer the following questions: 1. Discuss and explain the types of passwords are susceptible to dictionary attacks? [5 marks]

2. Can a password that can be broken by a dictionary attack be adequately strong if it is very long? Justify your answer. [5 marks]

3. Explain the types of passwords can be broken only by brute-force attacks. [5 marks]

4. What are the characteristics of passwords that are safe from even brute-force attacks? [5 marks]

5. Discuss why is it undesirable to use reusable passwords for anything but the least sensitive assets

In: Computer Science

Task 5 - Pipelining (20 marks) Robin, Bryan, Finchie, and Dan each have messages to send...

Task 5 - Pipelining
Robin, Bryan, Finchie, and Dan each have messages to send via carrier pigeon.
There are three ordered stages to sending a message via carrier pigeon::
1. 25 minutes of Writing the message
2. 10 minutes of Fanning the ink dry
3. 15 minutes of Catching and sending a pigeon
Notes: There is only one pen to share There is also only one fan (without it the ink
will never dry) There are multiple pigeons but only one can be caught at a time
(They startle easily) Fanning must happen before catching a pigeon (or it will fly
off.. startled)
(hint: Draw timeline diagrams to calculate the total times etc)

a) (4 + 7 = 11 marks) How long does it take for all to send messages sequentially?
How long does it take for all of them to send messages pipelined?

b) How and why does pipelining help with the throughput of entire
workloads?

The workloads involved in sending 4 messages as described above, in comparison
to sending 4 messages sequentially?

c) (2+3 marks) Can pipelining help reduce the latency of any one step in the 4
people sending a message scenario as described above?

Show how the pipeline rate is limited by the slowest pipeline stage.

In: Computer Science

Please show it with python class Node {     int data;     Node left, right;    ...

Please show it with python

class Node

{

    int data;

    Node left, right;

    public Node(int item)

    {

        data = item;

        left = right = null;

    }

}

public class BinaryTree {

// Root of the tree implemented in Node class

Node root;

Node findLowestCommonAncestor(int node1, int node2) {

    return findLowestCommonAncestor(root, node1, node2);

}

// This function returns pointer to LCA of two given

// values node1 and node2. This function assumes that node1 and

// node2 are present in Binary Tree

Node findLowestCommonAncestor(Node node, int node1, int node2) {

    /*

     * Base case condition ie. if The root itself is null then no point in checking further

     */

    if (node == null)

      return null;

    /*

     * If either node1 or node2 matches with root's key, report the presence by returning root (Note

     * that if a key is ancestor of other, then the ancestor key becomes LCA

     */

    if (node.data == node1 || node.data == node2)

      return node;

    // Look for keys in left and right subtrees

    Node left_lca = findLowestCommonAncestor(node.left, node1, node2);

    Node right_lca = findLowestCommonAncestor(node.right, node1, node2);

    /*

     * If both of the above calls return Non-NULL, then one key is present in once subtree and other

     * is present in other, So this node is the LCA

     */

    if (left_lca != null && right_lca != null)

      return node;

    // else check if left subtree or right subtree is LCA

    return (left_lca != null) ? left_lca : right_lca;

}

   /*

   * Main class to test LCA functions

   */

   public static void main(String args[]) {

     BinaryTree tree = new BinaryTree();

     tree.root = new Node(1);//root node

     tree.root.left = new Node(500);//left child of root node

     tree.root.right = new Node(271);//right child of root node

     tree.root.left.left = new Node(21);//left child of left child of root node

     tree.root.left.right = new Node(203);//right child of left child of root node

     tree.root.right.left = new Node(553);//left leaf node

     tree.root.right.right = new Node(991);//right leaf node

     System.out.println("LCA(500, 271) = " + tree.findLowestCommonAncestor(500, 271).data);

     System.out.println("LCA(21, 203) = " + tree.findLowestCommonAncestor(21, 203).data);

     System.out.println("LCA(53 , 991) = " + tree.findLowestCommonAncestor(53 , 991).data);

     System.out.println("LCA(1, 991) = " + tree.findLowestCommonAncestor(1, 991).data);

   }

}

In: Computer Science

Topic: IT Board of Directors Attention Deficit Establish a introduction Who has recently addressed this topic...

Topic: IT Board of Directors Attention Deficit

Establish a introduction

Who has recently addressed this topic in today journals?

What is the literature gaps for this topic?

The justification of why we should care about this topic.

In: Computer Science

Describe at least 3 ways in which you can improve the websites, give an example to...

Describe at least 3 ways in which you can improve the websites, give an example to explain each.

In: Computer Science

When is the conceptual schema of a database changed?- if we update data in the database...

When is the conceptual schema of a database changed?-

if we update data in the database

-if we alter the logical structure of the database

-if we retrieve data from the database

-if we alter the storage structure of the database

Which of the following has the same meaning as the outer union?

Group of answer choices

-the left outer (natural) join

-the right outer (natural) join

-the full outer (natural) join

-the inner (natural) join

Assume {A, B} is the primary key of relation schema R(A, B, C). Which of the following statements is NOT true:

Group of answer choices

{ A, B} must be unique

{A, B} must be a candidate key of R

A or B may have a NULL value

{A, B} must be a superkey

Which of the following examples is NOT an integrity constraint on a database:

Group of answer choices

A student name must be a string with a length ≤ 30

Database user ‘James’ cannot update data in the database

If two students have the same birthday, their ages must be the same

Every student must have a home address

Which of the following statements is true?

Group of answer choices

A foreign key may reference an attribute in its own relation

A relation can have only one foreign key

A foreign key cannot have a NULL value

A foreign key must reference the primary key of the referenced relation

The data dictionary in a database system is used to keep:

Group of answer choices

database schema

database instance

temporary data

final query result

Entities for a weak entity type can be uniquely identified by:

Group of answer choices

all attributes together of the weak entity type

the partial key of the weak entity type

a key of the owner entity type

the combination of (B) and (C)

In: Computer Science

Task 6 – CPU Architecture (20 marks) Please explain in your own words for each part...

Task 6 – CPU Architecture
Please explain in your own words for each part of Question 6. Quote your references in your ―References‖ /
―Bibliography‖
(a)
1. For modern CPU architectures please explain what is true about this statement.

“Why you cannot use CPU clock-speed only to compare computer performance.”

Marks will be awarded for research and clear explanations into CPU concepts of
threads, multi – threads, cores, relationship between cores and threads, multi-
tasking and multi-processing.

2. Explain how threads are used by the CPU to process tasks by describing a modern example, e.g., the multi-core mobile phone that you use every
day has an interesting organisation of threads.
However, it can be any other modern example of hardware that uses ―threads‖.

(b) There are a number of techniques used by CPU designers to improve
the performance of their processors. However, these optimisation strategies do not
always work – for some workloads, they may have no effect, or even cause performance to degrade.

What is a circumstance where simultaneous multi-threading (S.M.T.) cannot offer
any advantage, or possibly even cause a performance decrease

In: Computer Science

Task 3      Write a program that pushes the first 10 natural numbers to the stack,...

Task 3

     Write a program that pushes the first 10 natural numbers to the stack, then pops those numbers. Use the debugger to view how the stack changes after each instruction. Once all the data has been pushed to the stack, take a screenshot of the stack in memory.

Task 4

    Write a subroutine called “Area” that calculates the area of a rectangle. Use accumulator A and B to pass the length and the width to the function. Use accumulator D to return the result.

HINT:

  • load the width and height into accumulators A and B.
  • Call the subroutine.
  • Provide a flowchart, a snapshot of CPU registers before and after executing the subroutine.

    Now re-write the program from Task 3, but this time use the stack to pass the function arguments and the return value.

HINT:

  • load the width into accumulator A, then push A to the stack
  • load the height into accumulator B, then push B to the stack
  • Allocate one word on the stack for the return value.
  • Call the subroutine.
  • After you return from the function, deallocate all variables from the stack.
  • Provide a drawing of the stack frame and a snapshot of of the stack before, during and after executing the subroutine.

Write in Assembly for HCS12

In: Computer Science

Write a static method startsWith that inputs two Strings and returns a boolean. If the first...

Write a static method startsWith that inputs two Strings and returns a boolean. If the first input starts with the substring that is the second input, then the method returns true; otherwise, it returns false.

For example,

startsWith( "radar installation", "rad" )

returns

true

startsWith( "radar installation", "installation" )

returns

false

startsWith( "radar installation", "" )

returns

true

startsWith( "", "a" )

returns

false

startsWith( "", "" )

returns

true

In: Computer Science

Create a simple Swing application that animates a square diagonally across its window once. You may...

  1. Create a simple Swing application that animates a square diagonally across its window once. You may set the size of the window and assume that it doesn’t change. Using Java swing using timers

In: Computer Science

PYTHON CODING Using the structural node and methods discussed in Binary Search Tree below # Binary...

PYTHON CODING

Using the structural node and methods discussed in Binary Search Tree below

# Binary Tree Node structure

class Node:

# Constructor to create a new node

def __init__(self, data):

self.data = data

self.left = None

self.right = None

class BSTree():

def __init__(self, rootdata):

self.root = Node(rootdata)

  

def insert(self, data, cur_node):

if data < cur_node.data:

if cur_node.left == None:

cur_node.left = Node(data)

else:

self.insert(data, cur_node.left)

  

elif data > cur_node.data:

if cur_node.right == None:

cur_node.right = Node(data)

else:

self.insert(data, cur_node.right)

else:

print("Duplicate value!")

create a method for the Binary Search Tree that takes an unsorted input list and constructs a Binary Search Tree based on its values. Any duplicate value will only appear once on the tree. This method outputs a Binary Search Tree structure (not an enumeration of the tree). Discuss method's Big-O notation. Add proper and consistent documentation to identify code sections or lines to clearly identify its purpose.Illustrate the performance of method enumerating the tree using level-order-traversal method on 3 examples of sizes (10, 20 and 30) and on the data below.

datalist= [199, 666, 930, 751, 120, 411, 534, 716, 134, 379, 908, 97, 740, 904, 575, 437, 983, 835, 931, 768, 405, 544, 553, 821, 160, 312, 228, 324, 675, 622, 768, 312, 310, 18, 558, 170, 842, 214, 545, 857, 6, 71, 421, 909, 908, 377, 488, 837, 884, 382, 1, 654, 207, 751, 459, 450, 431, 462, 40, 926, 304, 594, 966, 386, 760, 39, 297, 557, 125, 327, 278, 328, 937, 195, 346, 419, 953, 681, 203, 173, 807, 710, 428, 415, 601, 258, 981, 464, 568, 546, 308, 883, 431, 948, 529, 55, 651, 73, 411, 719, 172, 43, 249, 695, 636, 603, 447, 652, 211, 736, 923, 27, 198, 427, 154, 572, 671, 314, 25, 428, 900, 930, 378, 806, 281, 805, 627, 748, 23, 961, 244, 587, 352, 939, 880, 69, 52, 702, 856, 990, 19, 743, 132, 793, 279, 500, 776, 921, 583, 487, 638, 753, 209, 870, 506, 995, 691, 743, 501, 831, 549, 369, 718, 780, 17, 636, 217, 486, 548, 500, 381, 116, 84, 683, 908, 151, 633, 404, 4, 426, 92, 614, 851, 714, 90, 789, 441, 985, 539, 470, 891, 384, 962, 259, 938, 211, 683, 560, 630, 893, 106, 841, 974, 114, 239, 896, 796, 524, 896, 974, 583, 729, 577, 863, 696, 530, 670, 467, 841, 401, 209, 596, 862, 702, 21, 219, 902, 271, 293, 350, 357, 182, 179, 909, 874, 769, 192, 39, 7, 487, 571, 155, 565, 231, 36, 544, 443, 24, 596, 570, 129, 585, 529, 557, 833, 270, 241, 732, 569, 839, 762, 881, 177, 149, 413, 806, 545, 591, 721, 289, 453, 53, 470, 215, 480, 218, 787, 915, 532, 626, 18, 349, 216, 338, 572, 979, 939, 76, 55, 49, 727, 524, 68, 403, 941, 234, 85, 991, 698, 561]

In: Computer Science

What does Risk Management mean? Briefly explain the different steps involved in risk management. Describe the...

  1. What does Risk Management mean? Briefly explain the different steps involved in risk management.

  1. Describe the system approach and its significance for project managers.

In: Computer Science

Write a static method endsWith that inputs two Strings and returns a boolean. If the first...

Write a static method endsWith that inputs two Strings and returns a boolean. If the first input ends with the substring that is the second input, then the method returns true; otherwise, it returns false.

For example,

endsWith( "radar installation", "rad" )

returns

false

endsWith( "radar installation", "installation" )

returns

true

endsWith( "radar installation", "" )

returns

true

endsWith( "", "a" )

returns

false

endsWith( "", "" )

returns

true

In: Computer Science

Task 7 - Memory (5 +5 + 5 +5 = 20 marks) Please explain in your...

Task 7 - Memory (5 +5 + 5 +5 = 20 marks)
Please explain in your own words for each part of Question 7. Quote your references in your ―References‖ /
―Bibliography‖

(a) What does INTEL‘s ―Optane Memory‖ provide?

(b) What are some of the claims made by the ―Intel Marketing Department regarding Optane Memory.
DDR5 memory is the latest computer memory being developed and will eventually
replace DDR4 memory.

(c) What are the maximum clocks speeds for DDR4 memory, and what is being
proposed for DDR5.

(d) What is the current maximum throughput available for DDR4 and what is
proposed for DDR5.

In: Computer Science