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
What is contained in the Open Files section of Shared Folders? ​
amm1812

Answer:

The contents of shared folders might include both programs and data files. Common files may be stored and accessed using shared application folders, which simplify administration and offer a single area for users to store and access common data. If all data files are consolidated in a single shared folder, users will have an easier time finding them.

Explanation:

Hope it helps:)

8 0
2 years ago
How are water resources and air adversely affected by environmental degardation?​
Nonamiya [84]

Answer:

Environmental degradation is one of the ten threats officially cautioned by the High-level Panel on Threats, Challenges and Change of the United Nations. The United Nations International Strategy for Disaster Reduction defines environmental degradation as "the reduction of the capacity of the environment to meet social and ecological objectives, and needs".[4] Environmental degradation comes in many types. When natural habitats are destroyed or natural resources are depleted, the environment is degraded. Efforts to counteract this problem include environmental protection and environmental resources management.

There are many examples of environmental degradation throughout the world. A recent example is the 2019 Amazon rainforest wildfires. The Amazon makes up 60% of all rainforests. It is the earth's lungs and with it getting destroyed is posing a huge threat to the environment and the whole world. The effects of the deforestation will pose major impacts on the world around us. The constant cutting down of trees is getting rid of our oxygen supply as well as the absorption of co2. With the continuation of deforestation we will have less available oxygen in the world which could have detrimental effects on human health. An alternate issue that results from this is the overconsumption and waste of the paper products that come from those trees. The waste it typically produces does not get recycled, therefore, immense amount of waste is created. An additional harmful result from this is the degradation of the soil. The constant deforestation causes the soil to become less nutrient which will make it harder to be used again.

Explanation:

Environmental degradation is one of the ten threats officially cautioned by the High-level Panel on Threats, Challenges and Change of the United Nations. The United Nations International Strategy for Disaster Reduction defines environmental degradation as "the reduction of the capacity of the environment to meet social and ecological objectives, and needs".[4] Environmental degradation comes in many types. When natural habitats are destroyed or natural resources are depleted, the environment is degraded. Efforts to counteract this problem include environmental protection and environmental resources management.

There are many examples of environmental degradation throughout the world. A recent example is the 2019 Amazon rainforest wildfires. The Amazon makes up 60% of all rainforests. It is the earth's lungs and with it getting destroyed is posing a huge threat to the environment and the whole world. The effects of the deforestation will pose major impacts on the world around us. The constant cutting down of trees is getting rid of our oxygen supply as well as the absorption of co2. With the continuation of deforestation we will have less available oxygen in the world which could have detrimental effects on human health. An alternate issue that results from this is the overconsumption and waste of the paper products that come from those trees. The waste it typically produces does not get recycled, therefore, immense amount of waste is created. An additional harmful result from this is the degradation of the soil. The constant deforestation causes the soil to become less nutrient which will make it harder to be used again.

4 0
3 years ago
What is the purpose of using specialized supply chain software?
weeeeeb [17]

Answer:

The purpose of supply chain management is

On the most basic level, the purpose of supply chain management is to make inventory readily available in customer facing positions to fulfill demand. ... Supply chain partners must work together to maximize resource productivity, develop standardized processes, eliminate duplicate efforts, and minimize inventory levels

Explanation:

4 0
2 years ago
What security weaknesses/vulnerabilities exist in Wireless local area network device hardware and software?
AfilCa [17]

Answer:

Explanation:

There are many weaknesses/vulnerabilities, some of which are the following...

Default Network Hardware, many individuals will go out and buy a new router and install it in their home. These devices come with a preset configuration including a preset security password which is many times a default password used for every router of the same model. This can be easily obtained by anyone who can then access the network.

Access Point hacking, an experienced individual can use a packet sniffer to detect the SSID that is frequently sent from the router in order to create an access point to be able to access the network.

WEP encryption is another vulnerability. These are very low security passwords that can be cracked using different software in a short period of time.

These are some of many vulnerabilities that wireless local networks have, but there are also many precautions and security measures that can be taken to prevent them.

7 0
3 years ago
On a printed circuit board, electronic components will be mounted from the
Likurg_2 [28]
On a printed circuit board, electronic parts will be mounted from the substrate side of the board. The leads jab through the substrate and the copper sheeting that has been carved. The leads are then soldered to the copper.

I hope the answer will help you. 
3 0
3 years ago
Other questions:
  • What is a Windows feature that allows you to temporarily store text?
    5·1 answer
  • What mass of nh3 can be made from 35g of n2?
    14·1 answer
  • What are features of a product?
    8·2 answers
  • Casey, a woodworker, is developing his own website. He plans to use the site as a means of selling his handmade furniture. While
    10·1 answer
  • An
    9·1 answer
  • Differentiate between trusted-source-security and antispoofing-security techniques.
    10·1 answer
  • An important communication principle states ""prepare before you communicate."" How should this preparation manifest itself in t
    10·1 answer
  • Question 19
    9·2 answers
  • What is best defined as a phishing email that is targeted directly at you?.
    14·1 answer
  • If a user wants to change one small section of the formatting of a document and leave the rest the same, which
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!