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
s2008m [1.1K]
3 years ago
10

SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classes listed in the Java Quick R

eference have been imported where appropriate. Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied. In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit. A mathematical sequence is an ordered list of numbers. This question involves a sequence called a hailstone sequence. Ifnis the value of a term in the sequence, then the following rules are used to find the next term, if one exists. If n is 1, the sequence terminates. If n is even, then the next term is n2. If n is odd, then the next term is 3n 1. For this question, assume that when the rules are applied, the sequence will eventually terminate with the termn

Computers and Technology
1 answer:
Ne4ueva [31]3 years ago
5 0

Answer:

Check the explanation

Explanation:

CODE:-

import java.util.*;

class UserName{

  ArrayList<String> possibleNames;

  UserName(String firstName, String lastName){

      if(this.isValidName(firstName) && this.isValidName(lastName)){

          possibleNames = new ArrayList<String>();

          for(int i=1;i<firstName.length()+1;i++){

              possibleNames.add(lastName+firstName.substring(0,i));

          }  

      }else{

          System.out.println("firstName and lastName must contain letters only.");

      }

  }

  public boolean isUsed(String name, String[] arr){

      for(int i=0;i<arr.length;i++){

          if(name.equals(arr[i]))

              return true;

      }

      return false;

  }

  public void setAvailableUserNames(String[] usedNames){

      String[] names = new String[this.possibleNames.size()];

      names = this.possibleNames.toArray(names);

      for(int i=0;i<usedNames.length;i++){

          if(isUsed(usedNames[i],names)){

              int index = this.possibleNames.indexOf(usedNames[i]);

              this.possibleNames.remove(index);

              names = new String[this.possibleNames.size()];

              names = this.possibleNames.toArray(names);

          }

      }

  }

  public boolean isValidName(String str){

      if(str.length()==0) return false;

      for(int i=0;i<str.length();i++){

          if(str.charAt(i)<'a'||str.charAt(i)>'z' && (str.charAt(i)<'A' || str.charAt(i)>'Z'))

              return false;

      }

      return true;

  }

  public static void main(String[] args) {

      UserName person1 = new UserName("john","smith");

      System.out.println(person1.possibleNames);

      String[] used = {"harta","hartm","harty"};

      UserName person2 = new UserName("mary","hart");

      System.out.println("possibleNames before removing: "+person2.possibleNames);

      person2.setAvailableUserNames(used);

      System.out.println("possibleNames after removing: "+person2.possibleNames);

  }

}

Kindly check the attached image below for the code output.

You might be interested in
Aubrey didnt like to use graphics or images on her slides. She preferred to use only a title for her slides and bullet-poinged t
Fed [463]

Hiya!


<u>Answer:</u>

Of the options given, your answer is A.) As long as you use it responsibly, it will enhance your slides and engage your audience.

<u>Why is this correct?</u>

While Aubrey may not enjoy using media, a visual aid is sometimes needed outside of text. Even if it's sometimes a graphic or a chart, it does wonders to  help it make sense; especially with a mixed bag of people and I'd suggest you google it yourself as well. This means B is out. Sayonara!

Secondly, there MUST be a balance between media and text. Too many images will, as Aubrey believes, have an adverse effect on the presentation. So much as a caption on your photos is good. C is tonight's big loser.

Finally, there is the split between A and D. What do we do now? Both make some lick of sense, right? Think again. Media may help entertain your audience, but that's not the point of presentations most of the time; It's to present information in both a graphical/verbal format without using a video. In fact, I'd say it's harder for a presenter to describe a photo on his own, meaning it will NOT take pressure off the presenter.


I hope my answer helped!

8 0
3 years ago
Read 2 more answers
Read the following scenario. How might Sarah correct successfully complete her task?
nexus9112 [7]

Answer:

Explanation:

A: To permanently remove a file from her computer, Sarah doubled-clicked on the My Computer icon and searched for her file under the “Uninstall or change a program” menu option.

or

b: empty the recycle bin : You can permanently delete a program file installed in the computer by following the procedure in option A. The option above will take you to the control panel and you'll be able to select the program you'd want to permanently remove. If you had initially deleted a file like a picture or a document or anything else that you necessarily do not need, it will go to recycle bin. You can head over there and select the Empty the Recycle Bin option to permanently delete the file.

4 0
3 years ago
The ____ category of apps makes the computer easier for blind people to use.
Schach [20]

The accessibility category of apps makes the computer easier for blind people to use. In general the accessibility apps are apps that help people with disabilities use a particular piece of hardware. For example there is an app designed to help blind people use their devices by paring them with a voluntary non-blind people trough audio-video connections.





4 0
3 years ago
Assume the following instruction mix for some program:______.
m_a_m_a [10]

Answer:

the answer is fart

Explanation:

5 0
3 years ago
What's the difference between joystick and mouse​
lyudmila [28]

Hey there! This is the difference between a joystick and a mouse:

A mouse is moved back and forth and up and down by a person's hand. The mouse device moves across the table surface. A joystick on the other hand stays stationary and is basically composed of a base and a stick. A vertical stick is held in the hand and tilted forward backward left and right. But the only thing that moves with a joystick is the center stick.

I hope this helps you out! Let me know if you have any questions!

5 0
3 years ago
Read 2 more answers
Other questions:
  • To use an outline for writing a formal business document what should you do after entering your bottom line statement
    10·1 answer
  • A(n)________________ is something that goes into a system a resource such as time,money,communication,etc
    10·1 answer
  • Write a function that iteratively appends random 1's and 0's to an array to form a binary number. The function returns the binar
    13·1 answer
  • It is illegal to have __________ emergency lights on your vehicle.
    6·2 answers
  • What are the features of Cobol language that make it suitable for programming business applications.
    6·1 answer
  • Which of the following are part of personal growth? Check all of the boxes that apply.
    8·2 answers
  • Write a program that prompts the user for the name of two files each containing a single line that represents a decimal integerc
    11·1 answer
  • Coral Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the a
    6·1 answer
  • Write a C# program named DoubleDecimalTest thatdeclares and displays two variables - a double and a decimal.Experiment by assign
    9·1 answer
  • What kinds of new input devices do you think might be invented in 10, 20, or 50 years? How might those devices change the world?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!