(1) Prompt the user to enter a string of their choosing. Output the string. Ex: Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself.
(2) Complete the GetNumOfCharacters() function, which returns the number of characters in the user's string. Use a for loop in this function for practice. (2 pts)
(3) In main(), call the GetNumOfCharacters() function and then output the returned result. (1 pt) (4) Implement the OutputWithoutWhitespace() function. OutputWithoutWhitespace() outputs the string's characters except for whitespace (spaces, tabs). Note: A tab is '\t'. Call the OutputWithoutWhitespace() function in main(). (2 pts)
Ex: Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself. Number of characters: 46 String with no whitespace: The only thing we have to fear is fear itself.

Answers

Answer 1
Answer:

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;

 }

}


Related Questions

An example of negative self-talk is:
You use utility software to_____. Select all that apply.A play video games B reformat a hard disk drive C manage fonts on a computer D write and edit documents
Which toplogy is common in these days? and justify atleast fivereason
When emergency changes have to be made to systems, the system software may have to be modified before changes to the requirements have been approved. Suggest a model of a pro- cess for making these modifications that will ensure that the requirements document and the system implementation do not become inconsistent.
Add CSS rules to articles.css for the given news article webpage that matches the following styling: Both article's images styled with a width of 300px Article's tag styled with: 5px padding all around Font family of Arial Font size of 24px Font color of white Background color of red. Selecting the id of author-name-and-date, style the author name and date with: Font family of Arial Font size of 12px Font color of lightgray Article's text ( and tags) styled with: Font family of Times New Roman Font size of 16px Font color of gray Article's share links ( tags) styled with: Font family of Arial Font size of 12px Font color of blue Note: Colors, font sizes, padding, etc. must be exact.

Write a program using integers user_num and x as input, and output user_num divided by x three times.Ex: If the input is:20002Then the output is:1000 500 250Note: In Python 3, integer division discards fractions. Ex: 6 // 4 is 1 (the 0.5 is discarded).LAB ACTIVITY2.29.1: LAB: Divide by x0 / 10main.pyLoad default template...12''' Type your code here. '''

Answers

Answer:

Following are the code to the given question:

user_num = int(input())#defining a variable user_num that takes input from user-end

x = int(input())#defining a variable x that takes input from user-end

for j in range(3):#defining for loop that divides the value three times

   user_num = user_num // x#dividing the value and store integer part

   print(user_num)#print value

Output:

2000

2

1000

500

250

Explanation:

In the above-given program code two-variable "user_num and x" is declared that inputs the value from the user-end and define a for loop that uses the "j" variable with the range method.

In the loop, it divides the "user_num" value with the "x" value and holds the integer part in the "user_num" variable, and prints its value.  

How will you ensure that all of the network's applications and tcp/ip services also support ipv6?

Answers

Answer:

Configure the Extended BSD API socket.

Explanation:

There are two types of logical network address, they are IP version 4 and up version 6. They are used to route packets to various destinations from various sources.

A network application must configure this IP addresses protocol. The IP version4 is the default address applications use. To enable IP version 6 the extended BSD API is configured on the network.

1. What is the host name that is resolved? 2. What is the probable IPv6 address of the attacker? 3. What is the probable IPv6 address of the attacked? 4. How do the IPv6 addresses you identified in questions b and c correlate to the top talkers list you made in Step 3?

Answers

Explanation:

The given question statement has been referenced from c h12_Osscan.pcapng document

The answers to the questions are;

Q1_Answer ; The host name that has been resolved is win7_03

Q2_Answer ; The likely IPv6 address of the attacker is 10.1.0.103

Q3_Answer ; The likely IPv6 address of the attacker is 10.1.0.102

Q4_Answer ; According to the document, it has been mentioned that the IP's stated above have been the top talkers meaning that there was significant communication or exchange of information between them

Conduct research to determine the best network design to ensure security of internal access while retaining public website availability.

Answers

The best method in network security to prevent intrusion are:

  • Understand and use OSI Model.  
  • Know the types of Network Devices.  
  • Know Network Defenses.  
  • Separate your Network.

How can I improve security through network design?

In the above case, the things to do is that one needs to focus on these areas for a a good network design. They are:

  • Physical security.
  • Use of good firewalls.
  • Use the DMZ, etc.

Therefore, The best method in network security to prevent intrusion are:

  • Understand and use OSI Model.  
  • Know the types of Network Devices.  
  • Know Network Defenses.  
  • Separate your Network.

Learn more about network security from

brainly.com/question/17090284

#SPJ6

Answer:

There are many benefits to be gained from network segmentation, of which security is one of the most important. Having a totally flat and open network is a major risk. Network segmentation improves security by limiting access to resources to specific groups of individuals within the organization and makes unauthorized access more difficult. In the event of a system compromise, an attacker or unauthorized individual would only have access to resources on the same subnet. If access to certain databases in the data center must be given to a third party, by segmenting the network you can easily limit the resources that can be accessed, it also provides greater security against internal threats.

Explanation:

In real-world environments, once the domains that are affected by the risks are identified, subsequent next steps would include:______.

Answers

Answer:

Explanation:

In real-world environments, once the domains that are affected by the risks are identified, subsequent next steps would include selecting, implementing, and testing controls to minimize or eliminate those risks.

Hello,Can you please help me with the following questions:
3. You enjoy technical matters, have a background in computer science and enjoy coding and playing video games in your free time. Which video game industry job would best match your profile?
a. Game tester
b. Producer
c. Programmer
d. Video game artist

6. Which of the following is an essential skill for game testers?
a. Thorough understanding of Java and C++
b. Technical drawing
c. Technical writing
d. Project management

9. Which of the following skills is the most important when applying for a game artist job?
a. Degree in arts
b. Strong art portfolio
c. Previous game testing experience
d, knowledge of scripting and codeing

10. The Stencyl program is recommended for ______.
a. creating 2D games
b. creating 3D games
c. Starting to learn to program
d. creating gaming art

11. You are passionate about video games, have spent part of your life in different countries and are fluent in their languages. You are considering looking for a job in video games. Which of the following jobs could you be qualified for, considering your skills and experience?
a. Game programming with a focus on languages
b. Translation
c. Game localization
d. Cultural gaming

12. Because it is one of the main programming languages used in some of the most popular game engines in the industry, which programming language does the author of the textbook recommend learning first?
a. Java
b. C Sharp
c. C++
d. SQL

13. Which of the following statements is NOT true about internships?
a. internships offer great opportunity to create and build connections within the industry.
b. Internships lead to a job offer upon successful completion
c. Internships offer an opportunity to get first-hand experience of the industry
d. Internships can be paid or unpaid

15. What is the best approach to take if you have not heard back from a company after applying for a job?
a. Wait, sometimes it takes time to process application and impatience can give a bad impression
b. Visit the company site personally to inquire about the status of your application
c. Try to find out on which side the process may be stalling and take appropriate steps to get the process moving forward, when possible
d. Reapply

18. You are applying for a game programmer job at a reputable gaming company. Your application may stand the best chance of being noticed if you include which of the following in your application?
a. List of all degrees and courses you have taken to acquire and hone your programming skills
b. Portfolio including samples of codes you have created
c. Portfolio including playable video game demo.
d. Portfolio of your artwork.

19. Which of the following is the most important item to include in your CV?
a. All gaming projects you have worked on, paid or unpaid.
b. Extracurricular activities related to gaming.
c. Major accomplishments
d. Short samples of code or technical writing samples.

20. Which of the following job hunting practices is the least effective?
a. Posting CV on job boards.
b. Searching for jobs on job posting sites
c. Doing an internship
d. Applying for a specific job posting via company website

Answers

Answer:

C, C, B, C, C, B, B or D, D, A or C, A, D

Explanation:

I am not taking whatever course you are taking, but I would like to know what you're taking. I have only answered the questions to the best of my abilities, so they might be wrong. Next time please award more points for a question so long.