Questions
Why the recursion in Pascal's Triangle is also the recursion for counting sub-sets.

Why the recursion in Pascal's Triangle is also the recursion for counting sub-sets.

In: Computer Science

I need this in PSEUDOCODE: Write a method, called PrintNumbers, that prints out the following sequence...

I need this in PSEUDOCODE:

Write a method, called PrintNumbers, that prints out the following sequence of numbers. The method must use a for-loop to print the outputs. HINT: “To get started: what’s the pattern from number X to (X+1)? Does it apply to the next pair of numbers?” 8 12 18 26 36 48 62

In: Computer Science

In python please 6.12 Mortgage Example A mortgage company is interested in automating their decision-making process....

In python please

6.12 Mortgage Example

A mortgage company is interested in automating their decision-making process.

As part of this automation, they are looking for a software that takes a set of information from each customer and identify

1) if a customer is eligible to apply for a mortgage

2) if a customer is qualified to get the mortgage of the requested amount,

eligibility criteria:

1. the applicant should be 19 or over 19 years old

2. the applicant should be the resident of that country (in the beginning assume that the applicant needs to be a resident of U.S.)

qualification criteria

1. the applicant should be eligible

2. the difference between the applicant's monthly income and applicant's monthly expenses should be greater than the mortgage monthly payments

Considering the code in the template, complete the code so that it prints; 1) if the user is eligible 2) the amount of monthly mortgage payment for the requested amount of mortgage with a specific interest rate taken from input and specific amount of time (in years) to pay off the mortgage, and 3) if the used is qualified

Hint: use this formula to calculate the monthly mortgage payment: (RequestedMortgageAmount + (RequestedMortgageAmount * overallinterestrate)) / (years * 12)

please consider 15%, 20% and 24% overall interest rate for pay offs in 10, 15, and 30 years, respectively. Round down the monthly mortgage payment using int() function.

Fix the mortgagemonthlypayment function and then call it in the main program with appropriate inputs.

Given code:

# we define four functions; eligible(), difference_btw_incomeAndexpense(), mortgae_monthly_payment() and qualify()
# reminder: each function is like a template and it does not run unless we call it with appropriate set of input values

# This function takes applicant's age and country of residence and return a boolean variable;if True meaning that the applicant is eligible
def eligible(age, country_of_residence):
elig = False
if (age >= 19) and (country_of_residence == 'USA'):
elig = True
return elig


# This function takes the family income value and all expenses and calculate the difference btw them and return the difference
def difference_btw_incomeAndexpense(family_income, loan_payments, educations_payment, groceryAndfood, others):
diff = family_income - (loan_payments + educations_payment + groceryAndfood + others)
return diff

# This function takes the user requested amount of mortgage and applies an interest rate to it and calculates the monthly payment amount
# This function applies 20% overall interest rate over 15 years
# you can make changes to this function and make it closer to what happens in reality. How ????????????????????
#def mortgage_monthly_payment(RequestedMortgageAmount):
# m_p = (RequestedMortgageAmount + (RequestedMortgageAmount * 0.2)) / (15 * 12)
# return m_p

def mortgage_monthly_payment(RequestedMortgageAmount, years):
#### FIX ME

# This function takes the output of the last two function and the amount of mortgage monthly payments and return if the applicant is qualified or not
def qualify(elig, diff, mortgage_monthly_payment):
qual = False
if (elig == True) and (diff > mortgage_monthly_payment):
qual = True
return qual
  
  
# the main program

# sometimes, we write a function and we want to use that in other Python scripts as a module.
# In this example, we want to use all three functions in the current program (script)
# the following if statement is used to tell Python that we want to use the above-defined functions in the current Python script.
if __name__ == "__main__":
  
print('please enter your age:')
age = int(input())
  
print('Please enter the country of residence. If you are a resident of the United States enter USA:')
country = input()
  
family_income = int(input('Please enter your family total monthly income:'))
  
loan_payment = int(input('Please enter your family amount of monthly loan payment:'))
  
edu = int(input('Please enter an estimate of your family amount of monthly education payment:'))
  
groceryAndfood = int(input('Please enter your family amount of monthly grocery and food expenses:'))
  
others = int(input('Please enter the amount of other expenses not listed above:'))
  
requested_mortgage_amount = int(input('Please enter the amount of the mortgage you arerequesting:'))

####### COOMPLETE ME

# we call eligible() function
# we keep the result of eligible() function in variable E and then test E using a conditional statement to print eligible or not eligible
E = eligible(age, country)
  
if E == True:
print('you are eligible')
else:
print('you are not eligible')

# calling difference_btw_incomeAndexpense() function and keeping its outcome in Difference variable so that we can use it later on when we call qualify() function
Difference = difference_btw_incomeAndexpense(family_income, loan_payment, edu, groceryAndfood, others)

# calling mortgage_monthly_paymenr() function and keeping its outcome in Mortgage_m_p variable to be used in qualify() function later on
# fixme

  
# calling qualify() function using the outputs of eligible(), E, the output of diff(), Difference, and the output of mortgage_monthly_payment(), Mortgae_m_p
Qual = qualify(E, Difference, Mortgage_m_p)

# since Qual is either True or Fasle, we want to use it to print a stetement to tell the user if they are qualified or not
if Qual == True:
print('you are qualified')
else:
print('you are not qualified')

In: Computer Science

You were hired as the manager for network services at a medium-sized firm. This firm has...

You were hired as the manager for network services at a medium-sized firm. This firm has 3 offices in 3 American cities. Recently, the firm upgraded its network environment to an infrastructure that supports converged solutions. The infrastructure now delivers voice, data, video, and wireless solutions. Upon assuming the role of network manager, you started reviewing the documentation and policies in place for the environment to ensure that everything is in place for the upcoming audit. You notice that a formal network security policy is nonexistent. You need one. The current network environment and services are as follows:

  • The environment hosts a customer services database.
  • The e-mail service is available, with each user having his or her own mailbox.
  • There is a sales team of 20 staff. They work remotely using laptops.
  • A routed voice network exists between offices.
  • Web services are available to clients on the Internet.
  • Wireless services cover public areas and conferences rooms.

Considering the network environment, services, and solutions that are supported, develop a network security policy of 3–4 pages for the environment, including the following:

  • Give consideration to each service, and recommend protection measures.
  • Risk mitigation is of extreme importance.
  • Confidentiality and integrity are important factors of network security. However, it should not affect availability.

In: Computer Science

Note: There is no database to test against FactoryUsers WorkerId Number(4) Not Null [PK] WorkerName Varchar2(20)...

Note: There is no database to test against

FactoryUsers
WorkerId Number(4) Not Null [PK]
WorkerName Varchar2(20)
CreatedDate DATE
CreatedBy Varchar2(20)

Create a stored procedure (SP) called Add_Worker that will add an employee to a factory. This SP has two parameters:

a) A parameter (WorkerId) that the SP can read or write to. When the procedure is called it will contain the PK value that should be used to add the row.

b) A parameter (WorkerName) that the SP can read only, it contains the new worker's username.

c) A parameter (Result) that the SP can write to. If the new record is added successfully, the parameter will be set to the value 'Entered Successfully'. If the add fails the parameter is set to the value 'Unsuccessful'.

Declare an exception named WORKER_NOT_ADDED. Associate the number -20444 with this exception.

Execute an insert statement to add the row to the table. Use the values of the passed parameters on the insert statement. Today's date should be used for the Created_date column. Use 'abcuser' for the CreatedBy column.

If the workerID is added:

a) Set the parameter 'Result' to 'Entered Successfully'

b) Commit the changes

Next, add exception processing to the SP

a) For all exceptions, set the parameter 'Result' to 'Unsuccessful'

b) If the WORKER_NOT_ADDED exception occurs, display the message 'New WorkerId already exists on the table.'

c_ For any other error, display the error number and the message associated with that error number.

In: Computer Science

Run the following code. Discuss the output result, i.e. the value of seq variable. #include <stdio.h>...

Run the following code. Discuss the output result, i.e. the value of seq variable.

#include <stdio.h>

#include <unistd.h>

int main()

{ int seq = 0; if(fork()==0) { printf("Child! Seq=%d\n", ++seq); }

else { printf("Parent! Seq=%d\n", ++seq);

} printf("Both! Seq=%d\n", ++seq); return 0; }

In: Computer Science

If answer can be shown using a c++ program and leave comments it will be very...

If answer can be shown using a c++ program and leave comments it will be very appreciated!!!

A bank charges $10 per month plus the following check fees for a commercial checking account: $0.10 each for fewer than 20 checks $0.08 each for 20-39 checks $0.06 each for 40-59 checks $0.04 each for 60 or more checks The bank also charges an extra $15.00 if the balance of the account falls below $400 (before any check fees are applied). Write a program that asks for the beginning balance and the number of check written. Compute and display the bank's service fees for the month. Input Validation: Do not accept a negative value for the number of checks written. If a negative value is given for the beginning balance, display an urgent message indicating the account is overdrawn.

Beginning balance: $-100 Number of checks written: 30 Your account is overdrawn! The bank fee this month is $27.40

Beginning balance: $400.00 Number of checks written: -20 Number of checks must be zero or more.

Beginning balance: $300.00 Number of checks written: 36 The bank fee this month is $27.88

Beginning balance: $300.00 Number of checks written: 47 The bank fee this month is $27.82

Beginning balance: $350.00 Number of checks written: 5 The bank fee this month is $25.50

Beginning balance: $300.00 Number of checks written: 70 The bank fee this month is $27.80

In: Computer Science

Program 1: Stay on the Screen! Animation in video games is just like animation in movies...

Program 1: Stay on the Screen! Animation in video games is just like animation in movies – it’s drawn image by image (called “frames”). Before the game can draw a frame, it needs to update the position of the objects based on their velocities (among other things). To do that is relatively simple: add the velocity to the position of the object each frame. For this program, imagine we want to track an object and detect if it goes off the left or right side of the screen (that is, it’s X position is less than 0 and greater than the width of the screen, say, 100). Write a program that asks the user for the starting X and Y position of the object as well as the starting X and Y velocity, then prints out its position each frame until the object moves off of the screen. Design (pseudocode) for this program

Sample run 1:

Enter the starting X position: 50

Enter the starting Y position: 50

Enter the starting X velocity: 4.7

Enter the starting Y velocity: 2

X:50 Y:50

X:54.7 Y:52

X:59.4 Y:54

X:64.1 Y:56

X:68.8 Y:58

X:73.5 Y:60

X:78.2 Y:62

X:82.9 Y:64

X:87.6 Y:66

X:92.3 Y:68

X:97 Y:70

X:101.7 Y:72

In: Computer Science

Instructions Write the definitions of the member functions of the class integerManipulation not given in Example...

Instructions

Write the definitions of the member functions of the class integerManipulation not given in Example 10-11. Also, add the following operations to this class:

  1. Split the number into blocks of n-digit numbers starting from right to left and find the sum of these n-digit numbers. (Note that the last block may not have n digits. If needed add additional instance variables.)
  2. Determine the number of zeroes.
  3. Determine the number of even digits.
  4. Determine the number of odd digits

Also, write a program to test theclass integerManipulation.

The header file for class integerManipulation has been provided for you.

integerManipulation.h:

class integerManipulation
{
public:
void setNum(long long n);
//Function to set num.
//Postcondition: num = n;

long long getNum();
//Function to return num.
//Postcondition: The value of num is returned.

void reverseNum();
//Function to reverse the digits of num.
//Postcondition: revNum is set to num with digits in
// in the reverse order.

void classifyDigits();
//Function to count the even, odd, and zero digits of num.
//Postcondition: evenCount = the number of even digits in num.
// oddCount = the number of odd digits in num.

int getEvensCount();
//Function to return the number of even digits in num.
//Postcondition: The value of evensCount is returned.

int getOddsCount();
//Function to return the number of odd digits in num.
//Postcondition: The value of oddscount is returned.

int getZerosCount();
//Function to return the number of zeros in num.
//Postcondition: The value of zerosCount is returned.

int sumDigits();
//Function to return the sum of the digits of num.
//Postcondition: The sum of the digits is returned.

integerManipulation(long long n = 0);
//Constructor with a default parameter.
//The instance variable num is set accordingto the parameter,
//and other instance variables are set to zero.
//The default value of num is 0;
//Postcondition: num = n; revNum = 0; evenscount = 0;
// oddsCount = 0; zerosCount = 0;

private:
long long num;
long long revNum;
int evensCount;
int oddsCount;
int zerosCount;
};

integerManipulationlmp.cpp:

main.cpp:

#include <iostream>

using namespace std;

int main() {
// Write your main here
return 0;
}

In: Computer Science

I need to access the values in the pizzaLocations array when main.cpp is run. The values...

I need to access the values in the pizzaLocations array when main.cpp is run. The values include name, address, city, postalCode, province, latitude, longitude, priceRangeMax, priceRangeMin. I tried declaring getter functions, but that does not work.

How do I access the values? Do I need to declare a function to return the values?

  • operator[](size_t) - This should return the location with the matching index. For example if given an index of 3, you should return the location at index 3 in the list.

#pragma once
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>

using std::getline;
using std::ifstream;
using std::string;
using std::stringstream;


struct Location {
   string name, address, city, postalCode, province;
   double latitude, longitude;
   int priceRangeMin, priceRangeMax;

   string getName(){ return name};

   string getAddress(){ return address};

   string getCity(){ return city};

   string getPostalCode(){ return postalCode};

   string getProvince(){ return province};

   double getLatitude(){ return latitude};

   double getLongitude(){ return longitude};

   int getPriceRangeMin(){ return priceRangeMin};

   int getPriceRangeMax(){ return priceRangeMax};
};

class PizzaZine {
   private:
      Location* pizzaLocations;
      size_t size;

   public:
      //default constructor

      PizzaZine()

      {

         pizzaLocations = new Location[50];

         this->size = 50;

      }

      //dynamically allocate array with user specified size

      PizzaZine(size_t size) { 

                pizzaLocations = new Location[size];

                this->size = size;

        }

      //destruct constructor

      ~PizzaZine()

      {

         delete[] pizzaLocations;

      }

      Location &operator[](size_t);//return the desired size for array

      // This function is implemented for you
      void readInFile(const string &);
};


Location &PizzaZine::operator[](size_t index)

{

   return pizzaLocations[index];

}

//this function has been implemented for you

void PizzaZine::readInFile(const string &filename) {
   ifstream inFile(filename);
   Location newLoc; //newLoc locally stores values of pizzaLocations?

   string line;
   string cell;

  

   // Read each line
   for (int i = 0; i < size; ++i) {
       // Break each line up into 'cells'
      getline(inFile, line);
    stringstream lineStream(line);


      while (getline(lineStream, newLoc.name, ',')) {
         getline(lineStream, newLoc.address, ',');
         getline(lineStream, newLoc.city, ',');
         getline(lineStream, cell, ',');
         if (!cell.empty()) {
            newLoc.postalCode = stoul(cell);
         }

     

         getline(lineStream, newLoc.province, ',');
         getline(lineStream, cell, ',');
         newLoc.latitude = stod(cell);
         getline(lineStream, cell, ',');
         newLoc.longitude = stod(cell);

         newLoc.priceRangeMin = -1;
         getline(lineStream, cell, ',');
         if (!cell.empty()) {
            newLoc.priceRangeMin = stoul(cell);
         }

         newLoc.priceRangeMax = -1;
         getline(lineStream, cell, ',');
         if (!cell.empty() && cell != "\r") {
            newLoc.priceRangeMax = stoul(cell);
         }


         pizzaLocations[i] = newLoc; //how do I retrieve the values in pizzaLocations once main.cpp is called?
      }//end of while loop
   }//end of for loop
}//end of readInFile function

In: Computer Science

How can I write java program code that do reverse, replace, remove char from string without...

How can I write java program code that do reverse, replace, remove char from string without using reverse, replace, remove method.

Only string method that I can use are length, concat, charAt, substring, and equals (or equalsIgnoreCase).

In: Computer Science

Implement the addSecond method in IntSinglyLinkedList. This method takes an Integer as an argument and adds...

Implement the addSecond method in IntSinglyLinkedList. This method takes an Integer as an argument and adds it as the second element in the list.

Here is an example of adding the Integer 7 to a list with two elements.

Abstract view: addSecond(7) on the list [12, 100] turns the list into [12, 7, 100]

Implement the rotateLeft method in IntSinglyLinkedList. It moves all elements closer to the front of the list by one space, moving the front element to be the last.

For example, here is what it looks like to rotateLeft once.

Abstract view: rotateLeft() on the list [12, 7, 100] turns the list into [7, 100, 12]

IntSinglyLinkedListTest.java

package net.datastructures;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.*;

public class IntSinglyLinkedListTest {

    @Test
    public void addSecondTest1() {
        IntSinglyLinkedList s = new IntSinglyLinkedList();
        s.addFirst(12);
        s.addSecond(7);
        // System.out.println(s);
        assertEquals(2, s.size());
        assertEquals(7, (int)s.last());
        assertEquals(12, (int)s.first());
    }

    @Test
    public void addSecondTest2() {
        IntSinglyLinkedList s = new IntSinglyLinkedList();
        s.addFirst(12);
        s.addFirst(7);
        s.addSecond(6);
        assertEquals(3, s.size());
        assertEquals(12, (int)s.last());
        assertEquals(7, (int)s.first());
    }

    @Test
    public void addSecondTest3() {
        IntSinglyLinkedList s = new IntSinglyLinkedList();
        s.addFirst(12);
        s.addSecond(7);
        s.addSecond(6);
        s.addSecond(1);
        assertEquals(4, s.size());
        assertEquals(7, (int)s.last());
        assertEquals(12, (int)s.first());
        assertEquals(12, (int)s.removeFirst());
        assertEquals(1, (int)s.first());
        assertEquals(1, (int)s.removeFirst());
        assertEquals(6, (int)s.first());
    }

    @Test
    public void rotateLeft1() {
        IntSinglyLinkedList s = new IntSinglyLinkedList();
        s.addFirst(7);
        s.addFirst(6);
        s.addFirst(5);
        s.addFirst(4);
        s.addFirst(3);
        s.rotateLeft();
        assertEquals(4, (int)s.first());
        assertEquals(3, (int)s.last());
        s.rotateLeft();
        assertEquals(5, (int)s.first());
        assertEquals(4, (int)s.last());
        s.rotateLeft();
        assertEquals(6, (int)s.first());
        assertEquals(5, (int)s.last());
        s.rotateLeft();
        assertEquals(7, (int)s.first());
        assertEquals(6, (int)s.last());
        s.rotateLeft();
        assertEquals(3, (int)s.first());
        assertEquals(7, (int)s.last());
    }
}

IntSinglyLinkedList.java

/*
 * Copyright 2014, Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
 *
 * Developed for use with the book:
 *
 *    Data Structures and Algorithms in Java, Sixth Edition
 *    Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
 *    John Wiley & Sons, 2014
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package net.datastructures;

/**
 * A basic singly linked list implementation.
 *
 * @author Michael T. Goodrich
 * @author Roberto Tamassia
 * @author Michael H. Goldwasser
 */

/* CS2230
This version of IntSinglyLinkedList replaces the generic type Integer
with Integer. It may be easier to read if generic types
are hurting your brain.
*/

public class IntSinglyLinkedList {
    //---------------- nested Node class ----------------
    /**
     * Node of a singly linked list, which stores a reference to its
     * element and to the subsequent node in the list (or null if this
     * is the last node).
     */
    private static class Node {

        /** The element stored at this node */
        private Integer element;            // reference to the element stored at this node

        /** A reference to the subsequent node in the list */
        private Node next;         // reference to the subsequent node in the list

        /**
         * Creates a node with the given element and next node.
         *
         * @param e  the element to be stored
         * @param n  reference to a node that should follow the new node
         */
        public Node(Integer e, Node n) {
            element = e;
            next = n;
        }

        // Accessor methods
        /**
         * Returns the element stored at the node.
         * @return the element stored at the node
         */
        public Integer getElement() { return element; }

        /**
         * Returns the node that follows this one (or null if no such node).
         * @return the following node
         */
        public Node getNext() { return next; }

        // Modifier methods
        /**
         * Sets the node's next reference to point to Node n.
         * @param n    the node that should follow this one
         */
        public void setNext(Node n) { next = n; }
    } //----------- end of nested Node class -----------

    // instance variables of the IntSinglyLinkedList
    /** The head node of the list */
    private Node head = null;               // head node of the list (or null if empty)

    /** The last node of the list */
    private Node tail = null;               // last node of the list (or null if empty)

    /** Number of nodes in the list */
    private int size = 0;                      // number of nodes in the list

    /** Constructs an initially empty list. */
    public IntSinglyLinkedList() { }              // constructs an initially empty list

    // access methods
    /**
     * Returns the number of elements in the linked list.
     * @return number of elements in the linked list
     */
    public int size() { return size; }

    /**
     * Tests whether the linked list is empty.
     * @return true if the linked list is empty, false otherwise
     */
    public boolean isEmpty() { return size == 0; }

    /**
     * Returns (but does not remove) the first element of the list
     * @return element at the front of the list (or null if empty)
     */
    public Integer first() {             // returns (but does not remove) the first element
        if (isEmpty()) return null;
        return head.getElement();
    }

    /**
     * Returns (but does not remove) the last element of the list.
     * @return element at the end of the list (or null if empty)
     */
    public Integer last() {              // returns (but does not remove) the last element
        if (isEmpty()) return null;
        return tail.getElement();
    }

    // update methods
    /**
     * Adds an element to the front of the list.
     * @param e  the new element to add
     */
    public void addFirst(Integer e) {                // adds element e to the front of the list
        head = new Node(e, head);              // create and link a new node
        if (size == 0)
            tail = head;                           // special case: new node becomes tail also
        size++;
    }

    /**
     * Adds an element to the end of the list.
     * @param e  the new element to add
     */
    public void addLast(Integer e) {                 // adds element e to the end of the list
        Node newest = new Node(e, null);    // node will eventually be the tail
        if (isEmpty())
            head = newest;                         // special case: previously empty list
        else
            tail.setNext(newest);                  // new node after existing tail
        tail = newest;                           // new node becomes the tail
        size++;
    }

    /**
     * Removes and returns the first element of the list.
     * @return the removed element (or null if empty)
     */
    public Integer removeFirst() {                   // removes and returns the first element
        if (isEmpty()) return null;              // nothing to remove
        Integer answer = head.getElement();
        head = head.getNext();                   // will become null if list had only one node
        size--;
        if (size == 0)
            tail = null;                           // special case as list is now empty
        return answer;
    }

    @SuppressWarnings({"unchecked"})
    public boolean equals(Object o) {
        if (o == null) return false;
        if (getClass() != o.getClass()) return false;
        IntSinglyLinkedList other = (IntSinglyLinkedList) o;   // use nonparameterized type
        if (size != other.size) return false;
        Node walkA = head;                               // traverse the primary list
        Node walkB = other.head;                         // traverse the secondary list
        while (walkA != null) {
            if (!walkA.getElement().equals(walkB.getElement())) return false; //mismatch
            walkA = walkA.getNext();
            walkB = walkB.getNext();
        }
        return true;   // if we reach this, everything matched successfully
    }

    public void rotateLeft() {

    }

    public void addSecond(Integer e) {

    }

    /**
     * Produces a string representation of the contents of the list.
     * This exists for debugging purposes only.
     */
    public String toString() {
        StringBuilder sb = new StringBuilder("(");
        Node walk = head;
        while (walk != null) {
            sb.append(walk.getElement());
            if (walk != tail)
                sb.append(", ");
            walk = walk.getNext();
        }
        sb.append(")");
        return sb.toString();
    }

    public static void main(String[] args) {
        IntSinglyLinkedList sl = new IntSinglyLinkedList();
        sl.addLast(100);
        sl.addLast(200);
        sl.addLast(300);
        System.out.println(sl.toString());
        System.out.println("Removed " + sl.removeFirst());
        System.out.println(sl.toString());
    }
}

In: Computer Science

To the TwoDArray class, add a method called sumCols() that sums the elements in each column...

To the TwoDArray class, add a method called sumCols() that sums the elements in each column and displays the sum for each column. Add appropriate code in main() of the TwoDArrayApp class to execute the sumCols() method.

/**

* TwoDArray.java

*/

public class TwoDArray

{

private int a[][];

private int nRows;

public TwoDArray(int maxRows, int maxCols) //constructor

{

a = new int[maxRows][maxCols];

nRows = 0;

}

//******************************************************************

public void insert (int[] row)

{

a[nRows] = row;

nRows++;

}

//******************************************************************

public void display()

{

for (int i = 0; i < nRows; i++)

{

for (int j = 0; j < a[0].length; j++)

System.out.format("%5d", a[i][j]);

System.out.println(" ");

}

}

}

/**

* TwoDArrayApp.java

*/

public class TwoDArrayApp

{

public static void main(String[] args)

{

int maxRows = 20;

int maxCols = 20;

TwoDArray arr = new TwoDArray(maxRows, maxCols);

int b[][] = {{1, 2, 3, 4}, {11, 22, 33, 44}, {2, 4, 6, 8},{100, 200, 300,

400}};

arr.insert(b[0]); arr.insert(b[1]); arr.insert(b[2]); arr.insert(b[3]);

System.out.println("The original matrix: ");

arr.display();

}

}

In: Computer Science

Write a short message of between 15 and 40 characters to your classmates. Encode it using...

Write a short message of between 15 and 40 characters to your classmates. Encode it using a linear affine cipher with n=26. Post the message to the “Encrypted Messages” thread but do not give the “a” and “b” that you utilized.

Also post your own initial response thread in which you propose at least one way that you might try to decipher messages without the key.

In: Computer Science

what do you think the coding for carplay is ? give some examples of the code...

what do you think the coding for carplay is ? give some examples of the code they would've used design etc.

In: Computer Science