Answer:
// Program is written in C++ Programming Language
// Comments are used for explanatory purpose
// Program starts here
#include<iostream>
using namespace std;
int main ()
{
// Declare Variable
int selection;
// Prompt user to make a selection of medium between air, water or steel.
cout<<"Make Selection"<<'\n'<<"Press 1 for Air"<<'\n'<<"Press 2 for Water"<<'\n'<<"Press 3 for Steel";
cin>>selection;
// Check for entry
if(selection == 1) {
cout<<"You selected Air"<<'\n';
cout<<"The distance travelled by sound wave in air is 1,125 feet in 1 second";
}
else if(selection == 2) {
cout<<"You selected Water"<<'\n';
cout<<"The distance travelled by sound wave in water is 4859 feet in 1 second";
}
else if(selection == 3) {
cout<<"You selected Steel"<<'\n';
cout<<"The distance travelled by sound wave in steel is 19554 feet in 1 second";
}
else
cout<<"Invalid Selection";
return 0;
}
Explanation:
This is easily solvable with a for loop. Something like:
(I assume c++)
#include <iostream>
#include <string>
int main() {
take_input: //tag
std::string input;
cin >> input; //take the input
int spaceCount = 0;
char checking;
for(unsigned int i = 0; i == input.length(); ++i) {
checking = spaceCount[i];
if(checking == ' ')
spaceCount++;
}
if(spaceCount >= 1 && input.length >= 5)
std::cout << "Your name is " + input;
else
goto take_input; // reasks for input if the conditions are not met
return 0;
};
**remove all spaces before using the code, the if statements are messed up
Answer:
import java.util.Scanner;
public class Solution {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter your value");
int value = scan.nextInt();
greaterThanFive(value);
}
public static void greaterThanFive(int userInput){
System.out.println(userInput > 5);
}
}
Explanation:
The first line import the Scanner which is use to enable to accept user input.
The class is defined as Solution in the next line. The main method is declared in the next line which signify the beginning of the program.
Then, a scanner object is declared called scan in the next line. Then a prompt is display to the user to input a value. The user input is stored in the variable value. The value is then passed to the method greaterThanFive.
The method greaterThanFive is declared and have just one parameter, the userInput. Inside the method, we output if the userInput is greater than 5 using the logical operator (>).
Answer:
patent
Explanation:
A patent is an intellectual property, with this legal protection, we can exclude to use, sell, and importation of an invention for a limited period of years, but we must do an enabling public disclosure of the invention or discovery, it is a requirement of the patent law, a patent is considered an advantage in the industries world.