Write an application that counts the total number of spaces contained in a quote entered by the user.

Answers

Answer 1

Answer:

Explanation:

The following code is written in Java. It asks the user for an input and saves it in a String variable. Then it loops through all the characters in the string and counts the spaces. Finally, it prints the total number of spaces in the String.

public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Line Now:");

       String userInput = in.nextLine();

       int spaceCount = 0;

       for (int x = 0; x < userInput.length(); x++) {

           if (userInput.charAt(x) == ' ') {

               spaceCount++;

           }

       }

       System.out.println(spaceCount);

   }


Related Questions

explain mechanical computer ,electromechanical and electronic computer with example

Answers

Answer:

A mechanical computer uses moving parts to do it’s calculations. Think old style adding machines.Electronic computers use electronic oscillators to generate a clock. The oscillator might include a mechanical element such as a crystal, but the majority of the clock signal is processed in the electrical domain.

Explanation:

An example of a mechanical computer clock is a Swiss watch movement, which needs no electronics. Movement is based upon springs coupled to other mechanical pieces. Swiss watches are high precision mechanical computers that do counting. There are other types of more sophisticated mechanical computers. Research the works of Konrad Zuse and his Z1 mechanical computer.

The designer of an agent traveled to a beach for a holiday. He took the agent to the beach. He wanted the agent to capture the sunrise and the high tide. What kind of knowledge representation will the agent use in this new environment?

A.
picture
B.
number
C.
graph
D.
meta

Answers

The answer is C. Which is graph

Answer:

Picture

Explanation:

Are Dogs are better than video games?

Answers

sometimes bc dogs are very lovey but video games also have there moments

Answer:

In some cases yes.

Explanation:

Some days I really enjoy my video games and other days I enjoy being with my dog but sometimes they are annoying especially if they have way more energy than you

References inserted initially as footnotes can be converted to endnotes through an option in the software.

A. True

B. False

Answers

The answer is A. True

The answer is: A) True

describe PROM, EPROM and EEPROM memories​

Answers

Answer:

Explanation:

PROM is a Read Only Memory (ROM) that can be modified only once by a user while EPROM is a programmable ROM that can be erased and reused. EEPROM, on the other hand, is a user-modifiable ROM that can be erased and reprogrammed repeatedly through a normal electrical voltage.

What was that show where lowe’s were based off eye colors and the main character had orange eyes that let her mind control people. It was either on netflix or hulu

Answers

The Innocents on Hulu i think

Answer:Raising Dion?

Explanation:

Was it Raising Dion?

Write a loop that sets newScores to oldScores shifted once left, with element 0 copied to the end. Ex: If oldScores

Answers

Answer:

Explanation:

The following is written in Java. It is a method/function that takes the oldScore as an int input. It turns it into a String, separates all the digits, puts them into an array. Then adds the first digit to the end and removes it from the beginning, thus shifting the entire score one to the left. Then it turns the String variable back into an Integer called finalScore and prints it out.

public static void newScore(int oldScore) {

       ArrayList<Integer> newScore = new ArrayList<>();

       String stringOldScore = String.valueOf(oldScore);

       for (int x = 0; x < stringOldScore.length(); x++) {

           newScore.add(Integer.parseInt(String.valueOf(stringOldScore.charAt(x))));

       }

       newScore.add(newScore.get(0));

       newScore.remove(0);

       String newScoreString = "";

       for (int x:newScore) {

           newScoreString += String.valueOf(x);

       }

       int finalScore = Integer.parseInt(newScoreString);

       System.out.println(finalScore);

   }

answer 1 question and get 10 points in return

Answers

Answer:

3

Explanation:

sorry if I'm wrong...it's been a while since I took a coding class.

3 I think... hope this helps!
Other Questions
How much time is required for a 20 Coulombs charge to flow through a point if the current is 2 amperes? help plzzzzz what process produces sex cells (sperm and egg)? Cellular Respiration Osmosis Meiosis Mitosis Which of the following is the most important skill to develop when pursuing screenwriting as a career?editingscript doctoringversatilityteamwork Please help me in a hurry Let V=2 and let H be the subset of V of all points on the line 4x+3y=12. Is H a subspace of the vector space V? Which sentence makes a factual claim?A cat is a smarter choice of pet than a dog, for most people. Cats aregenerally less expensive to care for than dogs, and they require lesswork from their human owners. When my family goes out of town, wethink it's great that our cat Nate can basically take care of himself for acouple of days. And although they are different, cats are just as muchfun as dogs.What Find the equation of the linear function represented by the table below in slope-intercept form. x y 1 -9 2 -13 3 -17 4 -21 We must breath in__ so our cells can gain more___ If 3x + 7 = 5 for some value of x, then what does the expression 6x +17 equal for the same value of x? You are purchasing a book that cost $22.00. The sales tax is 8%. What is the total amount of your purchase? A. $0.18 B. $1.76 C. $23.76 D. $17.60 how did martin luther protest against the sale of indulgences Which graph displays a directly proportional relationship? How does controlled destructionmake it easier to build newbuildings?I ready Ok guys 54 point trivia time!!!!!! What comes out of the TOASTER??a- Breadb- Toastc- Jamd- Ramen Which of the following equations is written in factored form?O y= 2x + 3x 8o y= 3 (2 + 5) (2 2)o y=-2(1 + 5)2 2O y = 3.2 - 5Need help please!! IN THE MIDDLE AGES, MUSIC DEVELOPED FROM MONOPHONY TODOTS AND DASHES IN MUSIC NOTATION TOTOFROM SINGLE TEXTS TOMUSIC FROM MEUSMATIC SINGING TOFROMFROM FREE STYLE RHYTHMIN SACRED While spending the weekend in your cabin, you burn wood in your pot-bellied stove to heat a kettle of water for tea. Answer the following questions for 2 points each:1. What type of energy does the wood have in this situation. Explain your answer.2. What type of energy is this transformed into as the wood it burned in the stove. Explain your answer.3. What type of heat transfer is being used to warm the kettle of water? Why does the water eventually boil? If a woman is heterozygous for widow's peak(widow's peak is dominant over a smooth hairline) has children with a man with a smooth hairline, whatare the possible phenotypes of their children?It is impossible to determine the possible phenotypes.O All of their children will have a widow's peak.O None of their children will have a widow's peak.It is possible for their children to either have widow's peak or a smooth hairline. In a direct variation, y=39 when x=3. Find the value of y when x=2.1.) 58.52.) 263.) 024.) 3 Sahil has a fish tank in the shape of a cuboid, as shown in the diagram