Answer:
Following are the program in the C++ Programming Language.
//set header file
#include <iostream>
//set namespace
using namespace std;
//define class
class format
{
//set access modifier
public:
//set string type variable
string res;
//define function
void names(string first_name, string last_name)
{
//set if-else if condition to check following conditions
if(first_name.length()>0 && last_name.length()>0)
{
res="Name: "+last_name+", "+first_name;
}
else if(first_name.length()>0 and last_name.length()==0)
{
res="Name: "+first_name;
}
else if(first_name.length()==0 and last_name.length()==0)
{
res="";
}
}
//define function to print result
void out(){
cout<<res<<endl;
}
};
//define main method
int main() {
//set objects of the class
format ob,ob1,ob2;
//call functions through 1st object
ob.names("John","Morris");
ob.out();
//call functions through 2nd object
ob1.names("Jhon","");
ob1.out();
//call functions through 3rd object
ob2.names("", "");
ob2.out();
}
<u>Output</u>:
Name: Morris, John
Name: Jhon
Explanation:
<u>Following are the description of the program</u>:
- Define class "format" and inside the class we define two void data type function.
- Define void data type function "names()" and pass two string data type arguments in its parameter "first_name" and "last_name" then, set the if-else conditional statement to check that if the variable 'first_name' is greater than 0 and 'last_name' is also greater than 0 then, the string "Name" and the following variables added to the variable "res". Then, set else if to check that if the variable 'first_name' is greater than 0 and 'last_name' is equal to 0 then, the string "Name" and the following variable "first_name" added to the variable "res".
- Define void data type function "out()" to print the results of the variable "res".
- Finally, we define main method to pass values and call that functions.
The declared variable name populationChange suitable for holding numbers like -593142 and 8930522 is as follows:
populationChange = -593142
populationChange = 8930522
<h3>Variable:</h3>
Variable are containers use for storing values of different datatypes. Python variable can be use to store various datatype without indicating the datatype. The variable can be used to store float, string, integer etc.
For example
myVariable = 345
The variable named populationChange that holds numbers like -593142 and 8930522 can be declared as follows;
populationChange = -593142
populationChange = 8930522
Note the code is written in python
learn more on python variable here: brainly.com/question/21335728
Answer:
Compound can be represented as a molecular formula,empirical formula, structural formula,ball and stick model, space filling model.
Explanation:
Compounds can be represented as a chemical formula and a molecular model.
A chemical formula shows the number of atoms present in a compound. Whereas, the molecular model shows the geometry of a compound.
The chemical formula can be further divided into 3 types:
1)molecular formula: indicates the actual number of atoms in a compound.
2)empirical formula: indicates the relative number of atoms present in a compound.
3)structural formula: is illustrated in the forms of lines which actually shows the bond(such as covalent bond) and also shows how atoms are connected to each other in a molecule.
Molecular model is preferably a better way to represent a molecule. It is categorised into the following:
1)a ball and stick model: its a three dimensional representation of a compound. The atom(s) in a compound is represented by ball while, their chemical bonds are shown by sticks.
2)A space filling model: its a three dimensional structure,it represents the size and shape of the whole molecule,showing relatively how much space each atom in a molecule occupies.