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
Assoli18 [71]
4 years ago
9

Then create a new Java application called "StringSlicer" (without the quotation marks) that uses methods to:

Computers and Technology
1 answer:
anyanavicka [17]4 years ago
5 0

Answer:

See the explanation section

Explanation:

import java.util.*;

//The above statement is to import the Scanner and ArrayList class

public class StringSlicer {

   public static void main(String args[]) {

   Scanner scan = new Scanner(System.in);

   System.out.println("Enter your string: ");

   String inputString = scan.nextLine();

   

   ArrayList<Character> stringList = new ArrayList<Character>();

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

           stringList.add(inputString.charAt(i));

       }

       

   for(Character letter: stringList){

           System.out.println(letter);

       }

   }

}

You might be interested in
1. Select two forms of case designed suitable for ATX power supply and
jekas [21]
The answer should be c
4 0
3 years ago
Design and implement an algorithm that gets as input a list of k integer values N1, N2,..., Nk as well as a special value SUM. Y
satela [25.4K]

Answer:

Follows are the code to this question:

def FindPair(Values,SUM):#defining a method FindPair  

   found=False;#defining a boolean variable found

   for i in Values:#defining loop for check Value  

       for j in Values:#defining loop for check Value

           if (i+j ==SUM):#defining if block that check i+j=sum

               found=True;#assign value True in boolean variable

               x=i;#defining a variable x that holds i value

               y=j;#defining a variable x that holds j value

               break;#use break keyword

       if(found==True):#defining if block that checks found equal to True

           print("(",x,",",y,")");#print value

       else:#defining else block

           print("Sorry there is no such pair of values.");#print message

Values=[3,8,13,2,17,18,10];#defining a list and assign Values

SUM=20;#defining SUM variable

FindPair(Values,SUM);#calling a method FindPair

Output:

please find the attachment:

Explanation:

In the above python code a method, "FindPair" is defined, which accepts a "list and SUM" variable in its parameter, inside the method "found" a boolean variable is defined, that holds a value "false".

  • Inside the method, two for loop is defined, that holds list element value, and in if block, it checks its added value is equal to the SUM. If the condition is true, it changes the boolean variable value and defines the "x,y" variable, that holds its value.
  • In the next if the block, it checks the boolean variable value, if the condition is true, it will print the "x,y" value, otherwise, it will print a message.  

6 0
3 years ago
Select the correct answer.
IrinaK [193]
The answer is the letter (D)
4 0
3 years ago
Why might a variable used for output have to be of a different type then a variable used for input?​
telo118 [61]

Answer:

You may use a different variable type for input in order to process the data appropriately and may use a different variable type to accommodate your program.

Explanation:

Your input may have to be different then output varying on what data you are processing.

For example, just like the last question you asked about calculating the area of the rectangle, your input MUST be converted to a different a numerical data type (i.e int or float) in order to do the math.

Based on your last question, if we didn't convert your input into a string your results wouldn't add the numbers together but only concatenate them. If I typed 3 & 5 as length & width, I would get 35 instead of 15.

Now another example is using functions (or methods whatever you want to call them), your input can be one thing and outputs another.

Let's say I want a function to tell me if I am smart. The way I want it to determine if its smart is by inputting my GPA into it, which is a numerical value. So the function would look something like this:

<u>Code (Python)</u>

def IsSmart(gpa):

  if (gpa >= 4):

       return True

  else

       return False

As you can see I am inputting a numerical value and it is outputting a boolean value. I can use this in a if else chain to spit out an output to the user.

7 0
3 years ago
The code repeat 3 [forward 50 right 120] creates which shape?
Basile [38]

Answer:

Triangle. D

Explanation:

I have no Idea, I was searching for the answer like most of you guys are doing. But my best guess is Triangle

7 0
3 years ago
Read 2 more answers
Other questions:
  • Paying attention to the trends that might impact your future career is called
    15·2 answers
  • Hich of the following usually indicates that there is no moreinput to be read by a program?
    14·1 answer
  • How are publishing used
    10·1 answer
  • 31. With interactive marketing,
    6·1 answer
  • Jane wishes to forward X-Windows traffic to a remote host as well as POP3 traffic. She is worried that adversaries might be moni
    14·1 answer
  • A _____ is an example of a systems program. A. command interpreter B. web browser C. text formatter D. database system
    10·1 answer
  • Which is a good guideline to follow when looking for research material on the Internet?
    10·2 answers
  • Gigantic Life Insurance is organized as a single domain. The network manager is concerned that dividing into multiple domains to
    15·1 answer
  • Who wants brainliest? First to answer gets it....
    12·2 answers
  • Sean is studying at a friend's house and notices that he can connect to the wireless network without entering a wireless network
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!