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
marishachu [46]
3 years ago
11

(1) Prompt the user to enter a string of their choosing. Output the string.

Computers and Technology
1 answer:
barxatty [35]3 years ago
6 0

Answer:

See solution below

See comments for explanations

Explanation:

import java.util.*;

class Main {

 public static void main(String[] args) {

   //PrompT the User to enter a String

   System.out.println("Enter a sentence or phrase: ");

   //Receiving the string entered with the Scanner Object

   Scanner input = new Scanner (System.in);

   String string_input = input.nextLine();

   //Print out string entered by user

   System.out.println("You entered: "+string_input);

   //Call the first method (GetNumOfCharacters)

   System.out.println("Number of characters: "+ GetNumOfCharacters(string_input));

   //Call the second method (OutputWithoutWhitespace)

   System.out.println("String with no whitespace: "+OutputWithoutWhitespace(string_input));

   }

 //Create the method GetNumOfCharacters

   public static int GetNumOfCharacters (String word) {

   //Variable to hold number of characters

   int noOfCharactersCount = 0;

   //Use a for loop to iterate the entire string

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

     //Increase th number of characters each time

     noOfCharactersCount++;

   }

   return noOfCharactersCount;

 }

 //Creating the OutputWithoutWhitespace() method

 //This method will remove all tabs and spaces from the original string

 public static String OutputWithoutWhitespace(String word){

   //Use the replaceAll all method of strings to replace all whitespaces

   String stringWithoutWhiteSpace = word.replaceAll(" ","");

   return stringWithoutWhiteSpace;

 }

}

You might be interested in
Which phrases suggest that Bob is a web administrator?
aliina [53]

"creates a weekly backup from a remote web server"

This implies that he is the owner of the server since, one, he backs it up every week, and two, he has access to create a backup.

3 0
3 years ago
Why would you use cell names in formulas instead of numbers?
ehidna [41]
<span>It is easier to remember cell names. not sure tho</span>
5 0
3 years ago
unexpected file format. please use tab-delimited bed, gff, or vcf. perhaps you have non-integer starts or ends at line 1?
Anon25 [30]

In case of the problem or error below, the issue is because the fields are said to be separated by a TAB as well as an extra space before "to" .

<h3>What is the error about?</h3>

In coding, one can encounter a lot of error. It can be a simple dot or even a hash tag.

Therefore,  note that BEDTools is one that givesa lot of file formats it is said to supports. So, the  Fields in a file need to be separated by TAB and the use of only TABs.

The example of an entry that can lead to this error is"

chrX<TAB><SPACE>136520467<TAB><SPACE>136520477

or say

chrX<TAB>136520467<SPACE><TAB>136520477<SPACE>

Therefore, In case of the problem or error below, the issue is because the fields are said to be separated by a TAB as well as an extra space before "to"

Learn more about coding error from

brainly.com/question/18497347

#SPJ1

See full question below

windowBed -a macs.bed -b gps.bed

Unexpected file format. Please use tab-delimited BED, GFF, or VCF.

Perhaps you have non-integer starts or ends at line 1?

Also these are few sample lines from bed file.

gps.bed

chrX 136520467 136520477

chr18 50319147 50319157

chr21 9827099 9827109

chr9 42819113 42819123

chrX 108297487 108297497

macs.bed

chr1 27856 29322

chr1 442104 442496

chr1 540185 540811

chr1 564698 565448

chr1 713184 714252

chr1 761694 762974

5 0
2 years ago
Initialize the tuple team_names with the strings 'Rockets', 'Raptors', 'Warriors', and 'Celtics' (The top-4 2018 NBA teams at th
dexar [7]

Answer:

Following is the code in python language

team_names = ('Rockets','Raptors','Warriors','Celtics')#holding the string value

print(team_names[0],team_names[1],team_names[2],team_names[3])#display

Output:

Rockets Raptors Warriors Celtics

Explanation:

Following is the description of above statement .

  • Create a dictionary "team_names" that is holding the string value Rockets Raptors Warriors and Celtics.
  • Finally we used the print function in that function we pass the index of corresponding dictionary i.e team_names[0] . it will display the first index value  similarly we pass  team_names[1], team_names[2]  team_names[3].
8 0
3 years ago
Statement: There are two files. One file, "badIP_list.txt" has a listing of known bad IP addresses. These addresses were extract
lapo4ka [179]

Answer:

See explaination

Explanation:

SOURCE CODE IN PYTHON:

inp=open('badIP_list.txt', 'r') #opening file for input

badIPs=[i.rstrip('\n') for i in inp.readlines()] #reading bad IPs

inp.close() #closing file

inp=open('server_logs.txt', 'r') #opening file for input

IPs=[i.rstrip('\n') for i in inp.readlines()] #reading all IPs from log

inp.close() #closing file

uniqueBadIPs=[] #to store unique bad IPs

countBadIPs=0 #to store count of bad IPs

countIPs=0 #to store count of all IPs

for IP in IPs: #iterating through the log of IPs

if IP in badIPs: #checking if IP is bad

countBadIPs+=1

if IP not in uniqueBadIPs: #checking if bad IP is unique

uniqueBadIPs.append(IP)

countIPs+=1

out=open('filter_list.txt', 'w') #opening file for output

out.write('_________________________________________________________\n')

out.write('Date : 26/07/2018\nName : Last, First\nMajor: CS\n\n')

out.write('Server logs contained these known bad IP addresses:\n')

for IP in uniqueBadIPs: #output the unique bad IPs

out.write(IP+'\n')

out.write('\n')

out.write('Total unique known bad IP\'s detected:\n'+str(len(uniqueBadIPs))+'\n\n')

out.write('Percentage of bad IP addresses in server logs:\n{:.2f}%\n'.format(countBadIPs*100/countIPs))

out.write('_________________________________________________________')

out.close() #closing file

5 0
4 years ago
Other questions:
  • _____ is a scam in which access to one's own computer is locked or restricted in some way.
    10·1 answer
  • What is the definition of the components that motherboards, ssds, processors, and cases are part of?
    10·1 answer
  • A _______ acts as a security buffer between a corporation's private network and all external networks.
    7·1 answer
  • The _____ handles the instructions for your computer to start up before the operating system is loaded.
    11·1 answer
  • What is a template class in c++?
    13·1 answer
  • In PumaMart system, why an initial offer is not necessary at the beginning of negotiation?
    6·1 answer
  • Would a hurricane form if the humidity is really high and the breeze is very low
    11·1 answer
  • When creating a shape in Word, what are some available options? Check all that apply. adding text to the shape changing the size
    6·1 answer
  • Can someone please give me Python test 3 it would help me tremendously
    5·1 answer
  • Please help me to creat flow chart​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!