1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
liberstina [14]
3 years ago
13

Edhesive in JAVA Write a method that takes a String parameter. If the String has a double letter (i.e. contains the same letter

twice in a row) then it should return true. Otherwise, it should return false.
This method must be named hasRepeat() and have a String parameter. This method must return a boolean.
Computers and Technology
1 answer:
Marizza181 [45]3 years ago
6 0

I've included my code in the picture below. Best of luck.

You might be interested in
If involved in a boating accident causing serious bodily injury or death while boating under the influence, the operator has com
9966 [12]

Answer:

felony

Explanation:

It is an offence on the part of a boat operator who is under the control of alcohol while boating, as such could result in property damage, serious bodily injury or death. Where such leads to bodily injury or deaths, the operator could be convicted for felony while misdemeanor applies to property damage.

There have been a reoccurring boating incidence in the country especially in the state of Florida, which has the highest number of boating fatalities hence created stiff penalties for boating under the influence of alcohol.

While it is adviseable for motorists not to drink and drive, it is also not lawful be under the influence when boating as such could cause injury, deaths or property damage and such operator would receive appropriate penalty depending on the outcome of the incident.

6 0
3 years ago
#include
gavmur [86]

Answer:

See explaination

Explanation:

#include <fstream>

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

// Fill in the code to define payfile as an input file

ifstream payfile;

float gross;

float net;

float hours;

float payRate;

float stateTax;

float fedTax;

cout << fixed << setprecision(2) << showpoint;

// Fill in the code to open payfile and attach it to the physical file

// named payroll.dat

payfile.open("payroll.dat");

// Fill in code to write a conditional statement to check if payfile

// does not exist.

if(!payfile)

{

cout << "Error opening file. \n";

cout << "It may not exist where indicated" << endl;

return 1;

}

ofstream outfile("pay.out");

cout << "Payrate Hours Gross Pay Net Pay"

<< endl << endl;

outfile << "Payrate Hours Gross Pay Net Pay"

<< endl << endl;

// Fill in code to prime the read for the payfile file.

payfile >> hours;

// Fill in code to write a loop condition to run while payfile has more

// data to process.

while(!payfile.eof())

{

payfile >> payRate >> stateTax >> fedTax;

gross = payRate * hours;

net = gross - (gross * stateTax) - (gross * fedTax);

cout << payRate << setw(15) << hours << setw(12) << gross

<< setw(12) << net << endl;

outfile << payRate << setw(15) << hours << setw(12) << gross

<< setw(12) << net << endl;

payfile >> hours ;// Fill in the code to finish this with the appropriate

// variable to be input

}

payfile.close();

outfile.close();

return 0;

}

4 0
3 years ago
The ArrayList class contains a trim method that resizes the internal array to exactly the capacity. The trim method is intended
andreev551 [17]

Answer:

public void trimToSize() {

modCount++;

if (size < elementData.length) {

elementData = (size == 0)

? EMPTY_ELEMENTDATA

: Arrays.copyOf(elementData, size);

}

}

Now, the running time for copyOf() function is O(N) where N is the size/capacity of the ArrayList. Hence, the time complexity of trimToSize() function is O(N).

Hence, the running time of building an N-item ArrayList is O(N^2).

Please find the sample code below.

CODE

==================

import java.util.ArrayList;

public class Driver {

  public static void main(String[] args) throws Exception{

      int N = 100000;

      ArrayList<Integer> arr = new ArrayList<>(N);

     

      long startTime = System.currentTimeMillis();

      for(int i=0; i<N; i++) {

          arr.add(i);

          arr.trimToSize();

      }

      long endTime = System.currentTimeMillis();

      double time = (endTime - startTime)/1000;

      System.out.println("Total time taken = " + time + " seconds.");

  }

}

Explanation:

5 0
3 years ago
Choose the correct term to complete the sentence
notka56 [123]

Answer:

popleft

Explanation:

5 0
3 years ago
In what country was the English royal family and nobility living before the Restoration?
krek1111 [17]

im not sure to be exact , but i think its england. i have done an assignment in the past and that was the awnser.....hope i help                      

4 0
3 years ago
Other questions:
  • Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest
    10·1 answer
  • Viet drives around and checks meters to document the amount of electricity used in homes. What Energy pathway is he a part of? E
    9·2 answers
  • convert the following c code to mips. assume the address of base array is associated with $s0, n is associated with $s1, positio
    14·1 answer
  • Drag each storage device to its category.
    7·1 answer
  • Book checkout scenario at a library: The Worker tells the System the identity of a patron who wishes to check out books. The Sys
    8·1 answer
  • Mirrors on cars exist to____.
    7·2 answers
  • E-mail messages, instant messages (IMs), or text messages sent and/or received within an organization a. are not included on a r
    9·1 answer
  • What is the IEEE 802 standards name for a wireless network that is limited to one person's workspace?
    14·1 answer
  • Potential Energy and Kinetic Energy both mean "energy in motion" True or False​
    8·2 answers
  • What is added to brining liquid to add flavour​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!