Questions
What does the following pseudocode axiom mean, in English? 1. ( aStack.push( item ) ).pop() =...

What does the following pseudocode axiom mean, in English?

1. ( aStack.push( item ) ).pop() = aStack

2. aList.getLength() = ( aList.insert( i, item ) ).getLength() - 1

3. ( aList.insert( i, item ) ).remove( i ) = aList

4. aList.getEntry( i ) = ( aList.insert( i, item ) ).getEntry( i+1 )

In: Computer Science

Implement Hot Potato game A group of people, numbered 1 to N, are sitting in a...

Implement Hot Potato game

A group of people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After X passes, the person holding the hot potato is eliminated, the circle closes ranks, and the game continues with the person who was sitting after the eliminated person picking up the hot potato. The last remaining person wins.

For example:

  • if X = 0 and N = 5, players are eliminated in order, and player 5 wins
  • If X = 1 and N = 5, the order of elimination is 2, 4, 1, 5.   

Write a program for general values of X and N.

  • Ask a user for number of people and number of passes
  • To speed up input, debugging, store names of the people in a file. Make sure no two names start the same letter ( Alex and Ana are not OK)
  • Output number and/or the name of a person being eliminated
  • Output number and the name of the winner
  • Allow user to play the game as many times as user wants
  • Node and List should be classes
  • use try/catch to check dynamic memory allocation
  • Make sure each function has a description, post and pre-conditions

In: Computer Science

I need the code in python where I can encrypt and decrypt any plaintext. For example,...

I need the code in python where I can encrypt and decrypt any plaintext. For example, the plaintext "hello" from each of these Block Cipher modes of Operation.

Electronic Code Block Mode (ECB)

Cipher block Mode (CBC)

Cipher Feedback Mode (CFB)

Output feedback Mode (OFB)

Counter Mode (CTR)

Here is an example, Affine cipher expressed in C.

Encryption:

char cipher(unsigned char block, char key) {

return (key+11*block) }

Decryption:

char invcipher(unsigned char block, char key) {

return (163*(block-key+256)) }

In: Computer Science

Create a vector of student records (minimum 15+ records) which is unsorted (For Vector, refer to...


Create a vector of student records (minimum 15+ records) which is unsorted
(For Vector, refer to Chapter 7.11 or 17.3, or you may use Array of structures)
- You should read student records from a file into the vector in C++
or in Java program.
- Display the unsorted 10+ student records (entire record, not just ID) and associated test scores.
- Each Student record should include Student ID, Name, GPA, Student Address, and a pointer which points to (10+) test scores somewhere in the program or in the file.
- Use QuickSort and recursion to Sort the student records according to student ID or GPA.
- Display the sorted list of student records (entire record, not just ID) and associated test scores.
- Repeat the above on two sets of student records. Each set with a minimum of
10 records.
Your program output must show proper information to be understood well
by the reader/viewer.

In: Computer Science

Create a Web page about a book ( The Richest Man in Babylon) that includes the...

Create a Web page about a book ( The Richest Man in Babylon) that includes the following:

-page title

-a meta keywords tag with at least (5) keywords

-a meta description tag

-a meta robots tag to allow indexing, but not permit crawling of the site

Also, provide 1-2 paragraphs of content with three relevant text links.

In: Computer Science

Write a C++ program which reads a string, less than 10 characters long. This string represents...

Write a C++ program which reads a string, less than 10 characters long. This string represents
an integer expressed in roman numbers. Let a function convert the number from roman to
arabic form (i.e., our standard digits). Let then the main program writes out both forms. The
roman numbers are written according to: M = 1000, D = 500, C =100, L=50, X=10, V=5, I=1.
Examples:
LXXXVII = 87
CCXIX = 219
MCCCLIV = 1354
MMDCLXXIII = 2673

In: Computer Science

A string of 0s and 1s is to be processed and converted to an even-parity string...

A string of 0s and 1s is to be processed and converted to an even-parity string by adding a parity bit to the
end of the string.(For an explanation of the use of parity bits, see Example 30 in Chapter 9.) The parity
bit is initially 0. When a 0 character is processed, the parity bit remains unchanged. When a 1 character
is processed, the parity bit is switched from 0 to 1 or from 1 to 0. Prove that the number of 1s in the final
string, that is, including the parity bit, is always even. (Hint: Consider various cases.)

In: Computer Science

Create a project that gets input from the user. ( Name the project main.cpp) Ask the...

Create a project that gets input from the user. ( Name the project main.cpp)

Ask the user for a value for each side of the triangle.

Comment your code throughout.

Include your name in the comments.

Submit the plan-Psuedo code (include Flowchart, IPO Chart) and the desk check with each submission of your code.

Submit the plan as a pdf.

Snips of your output is not a plan.

  • Save the plan and desk check as a pdf
  • Name the code main.cpp

Not a triangle

Expected Output

Remember to submit each time items below along with your code.

Plan (Psuedo code, Flowchart, IPO Chart)

Desk check

Starter Code:

"Welcome user. Type in the side lengths of your triangle and I will classify it. "<<endl;
"Enter the length of each side. "<<endl;


"This is not a triangle. All side lengths must be greater than zero."<<endl;


"This is not a triangle because the sum of the\ntwo smaller side lengths is not greater than the largest side length."<<endl;


"Your triangle is ";


"an equilateral triangle because all side lengths are equal."<<endl;

"a scalene triangle because no side lengths are equal."<<endl;

"an isosceles triangle because only two side lengths are equal."<<endl;

In: Computer Science

A. Discussion Thread: "Free Software" Consider the "Free Software" approach advocated by Richard Stallman and others...

A. Discussion Thread: "Free Software"

Consider the "Free Software" approach advocated by Richard Stallman and others (see Section 4.6 of Gift of Fire). Do you think this approach should be adopted? How do you think the Free Software approach would affect the quantity and quality of software that would be produced? Would the current funding methods for free software be sufficient? Are there other modifications of the current system of software licensing that should be considered? Which arguments for free software apply to music? What are some of the arguments people give to justify copying software? Debate whether software should be copyrightable or should be freely available for copying.

In: Computer Science

This assignment will test your knowledge and skills in C++. Create a class named employee and...

This assignment will test your knowledge and skills in C++.

  1. Create a class named employee and have the data members of:
    1. Name
    2. ID
    3. Salary
  2. Create a class named manager that inherits the employee class and adds the data members:
    1. Managed_Employees (Array of up to 3 employees)
    2. Department
  3. Create methods to update each data member in the employee class.
  4. Create a method to print out the managed employees sorted by their salary in the manager class. (You can use one of the sorting algorithms we learned)

In: Computer Science

B. Discussion Thread: "Digital Rights Management" Some people argue that digital rights management violates the public’s...

B. Discussion Thread: "Digital Rights Management"

Some people argue that digital rights management violates the public’s right to fair uses. Should people or companies that create intellectual property have the right to offer it for sale (or license) in a form protected by their choice of digital rights management technology (assuming the restrictions are clear to potential customers)? Should people have a legal right to develop, sell, buy and use devices and software to remove digital rights management restrictions for fair uses?

Companies selling music or movies can include digital rights management tools that cause files to self-destruct after a specified amount of time. Give some advantages and disadvantages of this practice. Do you think it is ethical for entertainment businesses to sell content with such a limitation? Why or why not?

In: Computer Science

This involves writing a Python program to determine the body-mass index of a collection of six...

This involves writing a Python program to determine the body-mass index of a collection of six individuals. Your program should include a list of six names. Using a for loop, it should successively prompt the user for the height in inches and weight in pounds of each individual. Each prompt should include the name of the individual whose height and weight is to be input. It should call a function that accepts the height and weight as parameters and returns the body mass index for that individual using the formula weight × 703 / height2. That body mass index should then be appended to an array. Using a second loop it should traverse the array of body mass indices and call another function that accepts the body mass index as a parameter and returns whether the individual is underweight, normal weight or overweight. The number of individuals in each category should be counted and the number in each of those categories should be displayed. You should decide on the names of the six individuals and the thresholds used for categorization.

Your program should include the pseudocode used for your design in the comments. Document the thresholds you chose for under weight and over weight in your comments as well.

In: Computer Science

The L&L bank can handle up to 30 customers who have savings accounts. Design and implement...

The L&L bank can handle up to 30 customers who have savings accounts. Design and implement a program that manages the accounts. Keep track of key information and let each customer make deposits and withdrawals. Produce error messages for invalid transactions. Hint: You may want to base your accounts on the Account class from chapter 5. Also provide a method to add 3 percent interest to all accounts whenever the method is invoked.

This is the account class in chapter 5:

Please use an array for all accounts. Thank you!

import java.text.NumberFormat;

public class Accounts
{



private NumberFormat fmt = NumberFormat.getCurrencyInstance();

   private final double RATE = 0.035;  // interest rate of 3.5%

   private int acctNumber;
   private double balance;
   private String name;

   //-----------------------------------------------------------------
   //  Sets up the account by defining its owner, account number,
   //  and initial balance.
   //-----------------------------------------------------------------
   public Accounts (String owner, int account, double initial)
   {
      name = owner;
      acctNumber = account;
      balance = initial;
   }

   //-----------------------------------------------------------------
   //  Validates the transaction, then deposits the specified amount
   //  into the account. Returns the new balance.
   //-----------------------------------------------------------------
   public double deposit (double amount)
   {
      if (amount < 0)  // deposit value is negative
      {
         System.out.println ();
         System.out.println ("Error: Deposit amount is invalid.");
         System.out.println (acctNumber + "  " + fmt.format(amount));
      }
      else
         balance = balance + amount;
      return balance;
   }

   //-----------------------------------------------------------------
   //  Validates the transaction, then withdraws the specified amount
   //  from the account. Returns the new balance.
   //-----------------------------------------------------------------


     public double withdraw (double amount, double fee)
       {
          amount += fee;

      if (amount < 0)  // withdraw value is negative
      {
         System.out.println ();
         System.out.println ("Error: Withdraw amount is invalid.");
         System.out.println ("Account: " + acctNumber);
         System.out.println ("Requested: " + fmt.format(amount));
      }
      else
         if (amount > balance)  // withdraw value exceeds balance
         {
            System.out.println ();
            System.out.println ("Error: Insufficient funds.");
            System.out.println ("Account: " + acctNumber);
            System.out.println ("Requested: " + fmt.format(amount));
            System.out.println ("Available: " + fmt.format(balance));
         }
         else
            balance = balance - amount;

      return balance;
   }

   //-----------------------------------------------------------------
   //  Adds interest to the account and returns the new balance.
   //-----------------------------------------------------------------
   public double addInterest ()
   {
      balance += (balance * RATE);
      return balance;
   }

   public double addInterestAll ()// I made this method myself but I am not sure if it is correct
   {
       balance += (balance * 0.03);
       return balance;
   }

   //-----------------------------------------------------------------
   //  Returns the current balance of the account.
   //-----------------------------------------------------------------
   public double getBalance ()
   {
      return balance;
   }

   //-----------------------------------------------------------------
   //  Returns the account number.
   //-----------------------------------------------------------------
   public int getAccountNumber ()
   {
      return acctNumber;
   }

   //-----------------------------------------------------------------
   //  Returns a one-line description of the account as a string.
   //-----------------------------------------------------------------
   public String toString ()
   {
      return (acctNumber + "\t" + name + "\t" + fmt.format(balance));
   }
}

In: Computer Science

Assume the input graph is directed but may or may not have cycle in it, that...

Assume the input graph is directed but may or may not have cycle in it, that is, may or may not be a directed acyclic graph. Consider the recursive topological sorting algorithm shown below. TopologicalSort(G) { If G has only one node v then return v. Find a node v with no incoming edge and remove v from G. Return v followed by the order returned by TopologicalSort(G). }

(a) Extend the recursive algorithm shown below so it can detect and output a cycle if the input graph G is not a directed acyclic graph. Clearly mark the extended part of the algorithm and state your reasoning behind the extension made.

In: Computer Science

Explain the following threats: SYN flood, Smurf and Port Scanning

Explain the following threats: SYN flood, Smurf and Port Scanning

In: Computer Science