Questions
The split method in the String class returns an array of strings consisting of the substrings...

The split method in the String class returns an array of strings consisting of the substrings split by the delimiters. However, the delimiters are not returned. Implement the following new method that returns an array of strings consisting of the substrings split by the matching delimiters, including the matching delimiters.
public static String[] split(String s, String regex)
For example, split("ab#12#453", "#") returns ab, #, 12, #, 453 in an array of String, and split("a?b?gf#e", "[?#]") returns a, ?, b, ?, gf, #, and e in an array of String.
Write a test program to show that your split method works properly.

PLEASE DO THE QUESTION IN A SIMPLER WAY

In: Computer Science

1) Write a function equation(A, B) that returns a value C where A + B =...

1) Write a function equation(A, B) that returns a value C where A + B = C

a. Write the equation function:

b: Write the output of your function for a few values:

2) Write a non-recursive function called fact(n) that computes n! Try computing fact(n) for large values. Can you find the maximum value for n your program will compute correctly?

a) Write your fact function:

b) Write the output of your function for a few values:

3)

  1. Write a function called printThem(n) which print the numbers from 1 to n with the following conditions:

  • In place of multiples of 3 print three.

  • In place of multiples of 5, print five.

  • If a number is divisible by both 3 and 5 print fifteen.

  • Do not print multiples of 7 (even if a multiple of 3)

Display 15 numbers per line. Include sample output for n=50. Note that 50 should be the parameter when you call your printThem function, not part of the function itself.

a) Print Them(n) function:

b) Write your output function

4)

  1. Write a function makeChange(amount) that for a given amount of money makes change for that amount in nickels, dimes, and quarters. You can assume the amount will be 100 cents or less. For example:

Change for 100:

  nickels: 4

  dimes: 3

  quarters: 2

When you are done, think about how you could calculate all possible ways to make change for that amount. That increases the complexity considerably, so it is not required for full credit.

a) Write the output of your makeChange function

b) Write your makeChange function:

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

Please answer these questions in C and write comments on why some actions are being done! Please give which function to write to each problem as well as the output function!! Thank you so much!

In: Computer Science

I want to print out the array as well as its intersection, and also it doesn't...

I want to print out the array as well as its intersection, and also it doesn't show the time elapsed after 100,000

Missing is: 1,000,000 and 10,000,000

import java.util.Random;
import java.util.HashSet;
import java.util.Arrays;

public class array_intersect {

public static void main(String[] args)
{
for(int i=1000; i <= 10000000; i= i*10)
{
Integer[] array1 = generate_random_array(i);
Integer[] array2 = generate_random_array(i);

long startTime = System.nanoTime();
get_intersection(array1, array2);
long stopTime = System.nanoTime();
long elapsedTime = stopTime - startTime;
System.out.println("Time elapsed for dataset of " + i + " points : "+ elapsedTime + " in nanoseconds");

}
}

public static Integer[] generate_random_array(int size)
{
Random rand = new Random();
Integer[] return_array = new Integer[size];
for(int i=0;i< size ; i ++)
{
return_array[i] = rand.nextInt(size);
}
return return_array;
}

public static Integer[] get_intersection(Integer[] array1, Integer[] array2)
{
HashSet<Integer> set = new HashSet<>();
set.addAll(Arrays.asList(array1));
set.retainAll(Arrays.asList(array2));

Integer[] intersection = {};
intersection = set.toArray(intersection);

return intersection;

}


}

In: Computer Science

Design a class named Account that contains: ■ A private int data field named id for...

Design a class named Account that contains:
■ A private int data field named id for the account (default 0).
■ A private double data field named balance for the account (default 0).
■ A private double data field named annualInterestRate that stores the current
interest rate (default 0). Assume all accounts have the same interest rate.
■ A private Date data field named dateCreated that stores the date when the account was
created.
■ A no-arg constructor that creates a default account.
■ A constructor that creates an account with the specified id and initial balance.
■ The accessor and mutator methods for id, balance, and annualInterestRate.
■ The accessor method for dateCreated.
■ A method named getMonthlyInterestRate() that returns the monthly interest rate.
■ A method named getMonthlyInterest() that returns the monthly interest.
■ A method named withdraw that withdraws a specified amount from the account.
■ A method named deposit that deposits a specified amount to the account.
Implement the class in Java as required by the design above. (Hint: The method getMonthlyInterest() is to return monthly interest, not the interest rate. Monthly interest is balance * monthlyInterestRate and monthlyInterestRate is annualInterestRate / 12. Note that annualInterestRate is a percentage, e.g., like 4.5%. You need to divide it by 100.)
Write a test program that creates an Account object with an account ID of 1122, a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500, use the deposit method to deposit $3,000, and print the balance, the monthly interest, and the date when this account was created.

PLEASE DO THE QUESTION IN A SIMPLER WAY

In: Computer Science

Report on hiding information and watermarks in Data security technologies?.

Report on hiding information and watermarks in
Data security technologies?.

In: Computer Science

A company’s IT policy states that passwords should contain 14 characters with a mix of letters,...

A company’s IT policy states that passwords should contain 14 characters with a mix of letters, numbers, and special characters. After reviewing the implemented policy within the IT system, it is noted that the current security settings stated that passwords only need to be 6 character long. Answer the following questions.

What are the threats?
What are the risks?
How would you mitigate the risks?

In: Computer Science

Perform the following base conversion using division and remainder method:4 marks a) 498base10 to base 3...

Perform the following base conversion using division and remainder method:4 marks
a) 498base10 to base 3
b) 2458base10 =
c) 961base10
d) 21base10 to base
3 5 9 7

In: Computer Science

2. [50] Write a C program to count the total number of commented characters and words...

2. [50] Write a C program to count the total number of commented characters and words in a C file taking both types of C file comments (single line and block) into account.

In: Computer Science

This program is written by Ruby and Please rewrite this program as python. input_lines = gets.split("...

This program is written by Ruby and Please rewrite this program as python.

input_lines = gets.split(" ")
tasizan = input_lines[0].to_i
hikizan = input_lines[1].to_i
cnt=-0

drill=[]
while cnt<tasizan
    kazu1 = rand(100)
    kazu2 = rand(100)
    next if kazu1+kazu2>99
    next if drill.include?("#{kazu1} + #{kazu2} =")
    drill.push("#{kazu1} + #{kazu2} =")
    cnt+=1
end
cnt=0
while cnt<hikizan
    kazu1 = rand(100)
    kazu2 = rand(100)
    next if kazu1 <= kazu2
    next if drill.include?("#{kazu1} - #{kazu2} =")
    drill.push("#{kazu1} - #{kazu2} =")
    cnt+=1
end
    puts drill.sample(tasizan+hikizan)

In: Computer Science

Describe the difference between IP and Network Access layer in TCP protocol and also explain the...

Describe the difference between IP and Network Access layer in TCP protocol and also explain the control information embedded in these two layers

In: Computer Science

In C language, Calculate the price of parking: First 60 minutes is Free; 61-80 minites is...

In C language, Calculate the price of parking:
First 60 minutes is Free;
61-80 minites is $4
Each additionat 20 minutes is $2
Maximum rate per day is $18 (24 hrs), so once it passes the 4 hrs to 24hrs parked will be $18
Note: If the input is invalid, print message “invalid input” and exit the program.

Example:

Hrs Parked: 8
Minutes Parked: 20
Price: $18
———————// If its over 24hrs add the previous days plus the new rate
Hrs Parked: 26
Minutes Parked: 28
Price: $34
———————
Hrs Parked: 95
Minutes Parked: 60
Price: $72

In: Computer Science

6. Add using binary addition 26 and 56 45 and 65      7. Subtract using binary...

6. Add using binary addition

  1. 26 and 56
  2. 45 and 65

     7. Subtract using binary two’s complement

  1. 23 from 45
  2. 34 from 65

In: Computer Science

why is a well-defined integrated change control system is so important to project success

why is a well-defined integrated change control system is so important to project success

In: Computer Science

this lab, you will write a shell script, called compare_cols.sh. This program should Read a CSV...

this lab, you will write a shell script, called compare_cols.sh. This program should

  • Read a CSV file from standard input (STDIN).
    • Note that in general, CSV files may contain quoted fields with embedded newlines. But for this assignment you can assume that there are no fields with embedded newlines, and therefore each new line represents a new row of the CSV file.
  • Print a single number (integer) to standard output (STDOUT): the count of the lines in the CSV file for which the first word occurring in column 3 of the CSV also occurs as a word in column 5 of the CSV.
    • For the purposes of this assignment, words are considered to be sequences of non-space characters delimited on either side by spaces or by the beginning/end of the text string.
    • Whitespace surrounding the integer output will be ignored for scoring.For example, in the following CSV row, the word "six" occurs at the beginning of column 3, and also as a word in column 5:
      one two three,four five,six seven,eight,nine six ten,eleven

Bashscript

In: Computer Science

What are IP address classes? Please explain each class and their characteristics.

What are IP address classes?

Please explain each class and their characteristics.

In: Computer Science