Answer:
It allows the designer to focus on main logic without being distracted by programming languages syntax.
* Since it is language independent, it can be translated to any computer language code.
* It allows designer to express logic in plain natural language.
* It is easier to write actual code using pseudocode.
* Unlike algorithms, pseudocodes are concise so pseudocodes are more readable and easier to modify.
Explanation:
Answer:
#include<iostream>//library inclusion
using namespace std;
int main()
{
int userInput;
do//start of do while loop
{
cout << "Enter a number less than a 100" << endl;
cin >> userInput;
if (userInput < 100) //condition
{
cout << "YOu entered less than a hundred: " << userInput << endl;
}
else
{
cout << "your number is greater than 100" << endl;
}
} while (userInput > 100);//condition for do while
return 0;//termination of int main
}
Explanation:
The program has been commented for you. The do-while loop enters the first loop regardless of the condition. Then after the first iteration, it checks for the condition. If the condition is being met, it will iterate through, again. Otherwise it will break out of the loop and land on the "return 0;" line. Which also happens to be the termination of the program in this case. The if-else condition is used for the user to see when prompted.
Explanation:
All five things i can come up with her
1. Doors (we either open or close them)
2. Tap (we either open or close the valve)
3. Electric stove/cooker
4. The lid of containers
5. Shoes/ foot wears(we put them ON or OFF)
Answer:
This article shows how to use regex to remove spaces in between a String.
A string with spaces in between.
String text = "Hello World Java.";
We want to remove the spaces and display it as below:
Hello World Java.
1. Java regex remove spaces
In Java, we can use regex \\s+ to match whitespace characters, and replaceAll("\\s+", " ") to replace them with a single space.
Regex explanation.
`\\s` # Matches whitespace characters.
+ # One or more
StringRemoveSpaces.java
package com.mkyong.regex.string;
public class StringRemoveSpaces {
public static void main(String[] args) {
String text = "Hello World Java.";
String result = text.replaceAll("\\s+", " ");
System.out.println(result);
}
}
Output
Terminal
Hello World Java.