Questions
Complete ArrayCollection.java with following methods (Please complete code in java language): public ArrayCollection(); public ArrayCollection(int size);...

Complete ArrayCollection.java with following methods (Please complete code in java language):

public ArrayCollection();

public ArrayCollection(int size);

public boolean isEmpty();

public boolean isFull();

public int size(); // Return number of elements in the Collection.

public String toString();

public boolean add(T element); // Add an element into the Collection, return true if successful

public boolean remove(T target); // Remove the target from Collection, return true if successful

public boolean removeAll(T target); // Remove all occurrences of Target, return if successful

public void removeDuplicate(); // Remove duplicated element(s)

public boolean equals(ArrayCollection that); // Return true if this Collection is same as that Collection

public int count(T target); // Return the number of a given target in the Collection

public void merge(ArrayCollection that); // Merge this Collection with that Collection

public void enlarge(int size); //Increase this Collection with additional size elements

public void clear(); // Clear entire Collection

public boolean contains(T target); // Return true if the target is in the Collection

public int findIndex(T target); // Return index of the target

package Homework3;

public class ArrayCollection<T> {

protected static final int DEFAULT_CAPACITY = 100;

protected T[] elements;

protected int numberOfElements;

public ArrayCollection() {

this(DEFAULT_CAPACITY);

}

public ArrayCollection(int size) {

elements = (T[]) new Object[size];

numberOfElements = 0;

}

public boolean isEmpty() {

return numberOfElements == 0;

}

public boolean isFull() {

return numberOfElements == elements.length;

}

public int size() {

return numberOfElements;

}

public String toString() {

String collection = "";

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

collection += elements[i] + "\n";

return collection;

}

public boolean add(T element) {

// Complete your code here

return true;

}

public boolean remove(T target) {

// Complete your code here

return true;

}

public boolean removeAll(T target) {

// Complete your code here

return true;

}

public void removeDuplicate() {

// Remove any duplicated elements

}

public boolean equals(ArrayCollection that) {

// Return true if ArrayCollection are identical.

boolean result = true;

// Complete your code here.

return result && this.size() == that.size();

}

public int count(T target) {

// Return count of target occurrences

int c = 0;

// Complete your code here

return c;

}

public void merge(ArrayCollection that) {

// Merge that ArrayCollection into this ArrayCollection

// Complete your code here

}

public void enlarge(int size) {

// Enlarge elements[] with additional size

// Complete your code here

}

public void clear() {

// Remove all elements in the collection

}

//Note: Different from textbook, this implementation has no 'found' and

'location' attributes.

// There is no find() method.

// There is a new methods findIndex().

public boolean contains(T target) {

// Return true if target is found

boolean found = false;

// Complete your code here

return found;

}

public int findIndex(T target) {

// Return index of target

int index = 0;

// Complete your code here

return index;

}

}

In: Computer Science

In the fall 0f 2008 Countrywide Morgage Corporation announced that the private information for thousands of...

In the fall 0f 2008 Countrywide Morgage Corporation announced that the private information for thousands of their customers, including social security numbers and loan numbers, had been compromised. Countrywide offered these customers a free 2-year subscription to a credit protection service. Should this action shield Countrywide from customer lawsuits? Could Countrywide do more? Should they? Given that it was a Countrywide employee who sold the data, does this change Countrywide's responsibilities toward the affected customers? Explain why or why not.

Answer in 3 paragraphs.

In: Computer Science

Why is an understanding of user requirements important, and what might it include? Discuss in 120–150...


Why is an understanding of user requirements important, and what might it include? Discuss in 120–150 words.

b)Why would an organisation compare a measure of consistency and reliability? Discuss in 120–150 words

c)

List 10 features that should be included in an AIS

In: Computer Science

In web programming what is the Client-Server model?

In web programming what is the Client-Server model?

In: Computer Science

Your task is to build an Android application that satisfies the following requirements: Has two activities:...

Your task is to build an Android application that satisfies the following requirements:

  • Has two activities: MainActivity that implements the main functionality of the application and AboutActivity that shows your full name as per college record and student id

  • The AboutActivity should be available through a menu

  • A back button should appear in the ActionBar of the AboutActivity that takes user back

    to the MainActivity. It should be done through configuration!

  • MainActivity should implement the following functionality

    o read the following input from the user: § number of hours worked

    § hourly rate
    o calculate the pay using the following formula

    § if no of hours is less or equal than 40 then pay=no_of_hours*hourly_rate

    § else, pay=(no_of_hours-40)*hourly_rate*1.5 + 40*hourly_rate o calculate the tax using the following formula

    § tax=pay*0.18
    o present following data to the user

§ pay
§ overtime pay § total pay
§ tax

In: Computer Science

Time Complexity: Build a table in Excel and record the time complexity taken by linear and...

Time Complexity: Build a table in Excel and record the time complexity taken by linear and binary search to look for an element with the following array sizes: 10, 50, 100, 200, 500, 700, 1000. Compare the performance of both algorithms highlighting the time complexity for both algorithms when run on small input size and when run on large input size.


To accomplish this, load a list with the file data and then create a program that selects at random X amount of elements from the original list (where X is a value that the user selects) and place them in an array, then select at random an element in the original list to search in the sampled array using both algorithms. Measure the time it takes for both algorithms on an array of a given input size.

In: Computer Science

Hello! I need to present my xml file on the Windows form application I tried but...

Hello!

I need to present my xml file on the Windows form application I tried but it dosent work at button 2, I cann't show Xml_file. What is problem here please? have you any suggest or solution .

Here is my form code!

namespace MyFirstWindos
{
 public partial class Form1 : Form
 {
    const string XML1 = "path";
    const string XML2 = "Path";
    const string ResultFile = "Path"; 

    public Form1()
    {
        InitializeComponent();
    }

    private void Run(object sender, EventArgs e)//run button
    {
        Compare_D_R d_R = new Compare_D_R();
        d_R.compareD_R();
    }

    private void Button3_Click(object sender, EventArgs e)
    {
        xmlGridView.ClearSelection();

    }

    private void Button2_Click(object sender, EventArgs e)//show
    {
        if (showinput.Text != null) {
            string DefaultFile = "DefaultFile": 
            string Alternative = "AlternativeFile";
            string Result = "ResultFile";

            if (  DefaultFile==showinput.Text) {
                DataSet ds = new DataSet();
               xmlGridView.DataSource = ds.ReadXml(XML1);

            }
            if (Alternative == showinput.Text) {
                xmlGridView.DataSource = XML2;
            }
            if (Result == showinput.Text)
            {
                xmlGridView.DataSource = ResultFile;
            }
            else
            {
                MessageBox.Show("Invalid Input");
                showinput.Text = string.Empty;
                showinput.Focus();
            }

        }

    }

    private void TextBox1_TextChanged(object sender, EventArgs e)
    {

    }

    private void XmlGridView_CellContentClick(object     sender,DataGridViewCellEventArgs e)
    {

    }

    private void Button4_Click(object sender, EventArgs e)
    {

    }
 }
 }

How can I play/show my xml_file on the grid view. I'm really new in winform so please try to understand my question. if you have a better Idea you are welcome it is a free desigen.

Thanks:

In: Computer Science

In web programming what is the Client-Server model?

In web programming what is the Client-Server model?

In: Computer Science

Determine the memory address of A[3], A[10], A[20] a) given int A[] b) given short A[]...

Determine the memory address of A[3], A[10], A[20]

a) given int A[]

b) given short A[]

c) given char A[]

In: Computer Science

Python programming ***************************************************************************************************** If we load the json files then how could we use the objects...

Python programming

*****************************************************************************************************

If we load the json files then how could we use the objects to extract particular values from those files.

eg:

fi1 = open("king.json", "rb")
obj1 = yaml.safe_load(fi1.read())
fi1.close()

fi2 = open("queen.json", "rb")
obj2 = yaml.safe_load(fi2.read())
fi2.close()

Now if the JSON file queen.json had elements like name, rule year, children, etc. and we wanted the name of the queen who ruled between particular years, how would we do it?

second would be getting a value common for both files? like the name of king and queen who ruled between specific years.

In: Computer Science

Write a recursive method to sum the values in an array of integers. Create a file...

Write a recursive method to sum the values in an array of integers. Create a file ArraySum.java and add the recursive method public int sumOfArray (). Use the driver class ArraySumDriver.java to populate your array and demonstrate that your method works.

////ArraySumDriver.java///////
public class ArraySumDriver {
   private final static int ARRAY_SIZE = 6;

   /**
    * @param args
    */
   public static void main(String[] args) {
      int index = 0;

      Integer[] myArray = new Integer[ARRAY_SIZE];
      ArraySum arraySum = new ArraySum();
      
      myArray[index++] = 3;
      myArray[index++] = 5;
      myArray[index++] = 2;
      myArray[index++] = 6;
      
      int sum = arraySum.sumOfArray(myArray, 3);
      System.out.println(sum);
      
      myArray[index++] = 7;
      myArray[index++] = 1;
      
      sum = arraySum.sumOfArray(myArray, 5);
      System.out.println(sum);
   }

}

In: Computer Science

need new and unique answers, please. (Use your own words, don't copy and paste), Please Use...

need new and unique answers, please. (Use your own words, don't copy and paste), Please Use your keyboard (Don't use handwriting) Thank you..

Q3:

You have been hired to design a database for prescriptions for RX pharmacies and your first job now is to design an ER model for this database using the following description of that world.

i. patients are identified by their SSN and have other attributes as names, addresses, and ages.

ii. Doctors are identified by their SSN and have other attributes as names, specialty, and years of experience.

iii. Each pharmaceutical company is identified by name and has a phone number.

iv. For each drug, the trade name and formula must be recorded. Each drug is sold by a given pharmaceutical, and the trade name identifies a drug uniquely from among the products of that company. If a pharmaceutical company is deleted, you need not keep track of its products any longer.

v. Each pharmacy sells several drugs and has a price for each. A drug could be sold at several pharmacies, and the price could vary from one pharmacy to another.

vi. Doctors prescribe drugs for patients. A doctor could prescribe one or more drugs for several patients, and a patient could obtain prescriptions from several doctors. Each prescription has a date and a quantity associated with it. You can assume that if a doctor prescribes the same drug for the same patient more than once, only the last such prescriptions needs to be stored.

vii. Pharmaceutical companies have contracts with pharmacies. A pharmaceutical company can have contracts with several pharmacies and a pharmacy can have contracts with several pharmaceutical companies. For each contract, you need to store a start date, an end date and the contract text.

viii. Pharmacies appoint a supervisor for each contract. There must always be a supervisor for each contract.

Hint: Present the conceptual design first, showing (1) all the entities and their attributes, (2) all the relationships and their attributes, (3) all the constraints before drawing your ER.

Specific Requirement /Constraint Type

Requirements and Constraints from the ER diagram

Entities and attributes in ER

(1 Mark)

Relationships and attributes in ER

(0.75 Mark)

Interpretation of each of the constraints represented on the edge labels in ER

(0.75 Mark)

ER Diagram goes next: (1 Mark)

You have to draw it digitally and attach. Note that in the ER diagram, the foreign key attributes that are part of the relationship schemas are not explicitly listed with the relationship but inherited from the entity the relationships are connected to.

Ans.

In: Computer Science

Need the history of amazon echo as a device. For example: when it was created, when...

Need the history of amazon echo as a device. For example: when it was created, when did amazon decide to begin creating thiz device, which of Amazon's subsidiary was developing echo. And some general things from echo's history

In: Computer Science

Write a program in C++ that generates a random number between 1 and 10 and asks...

Write a program in C++ that generates a random number between 1 and 10 and asks the user to guess it. Your program should continue until the user guesses the correct number. With each guess the user makes the program tells the user if the guess is too high or too low.

To generate a random number between 1 and 10 you need the following code:

  /* initialize random seed: */
  srand (time(NULL));
  /* generate secret number between 1 and 10: */
  secretnumber = rand() % 10 + 1;

You also need to add these lines to the top of your program with the other <include> statements so you can use the time() function:

#include <time.h>
#include <stdlib.h>
#include <stdio.h> 

In: Computer Science

write a python function that takes a number as input argument, and that tries to determine...

write a python function that takes a number as input argument, and that tries to determine two other integers, root and pwr, such that root**pwr is equal to the integer passed as an argument to the function. Consider that pwr > 1. The function should return the values of root and pwr, as a string in the form root**pwr. For example, when the passed argument is 8, the function should return the string ‘2**3’. When the passed input argument does not have a root**pwr representation, the function should return the value None. Write a “docstring” for the function specifying its input parameter, its assumption and the return value that the user should expect. Write a small program that requests the user to enter several numbers, and then, for each, calls the function to determine the power representation if it exists, and finally to print this representation or, if no such representation exists, to write some suitable message. Select a proper sentinel for the user to enter in order to stop the program. Make sure you inform the user of the type of sentinel that you select.

In: Computer Science