Hey dude don't leave tell a mod bout it they'll fix everything up for you.
Answer:
Following are the code to this question:
#include <iostream> //defining header file
using namespace std;
void numbers(ostream &outs, const string& prefix, unsigned int levels); // method declaration
void numbers(ostream &outs, const string& prefix, unsigned int levels) //defining method number
{
string s; //defining string variable
if(levels == 0) //defining condition statement that check levels value is equal to 0
{
outs << prefix << endl; //use value
}
else //define else part
{
for(char c = '1'; c <= '9'; c++) //define loop that calls numbers method
{
s = prefix + c + '.'; // holding value in s variable
numbers(outs, s, levels-1); //call method numbers
}
}
}
int main() //defining main method
{
numbers(cout, "THERBLIG", 2); //call method numbers method that accepts value
return 0;
}
Output:
please find the attachment.
Explanation:
Program description:
- In the given program, a method number is declared, that accepts three arguments in its parameter that are "outs, prefix, levels", and all the variable uses the address operator to hold its value.
- Inside the method a conditional statement is used in which string variable s and a conditional statement is used, in if the block it checks level variable value is equal to 0. if it is false it will go to else block that uses the loop to call method.
- In the main method we call the number method and pass the value in its parameter.
Answer:
showProduct(int,double)
for example: showProduct(10,10.5) is the correct answer even showProduct(10,10.0) is also correct but showProduct(10.0,10.5) or showProduct(10,10) or showProduct(10.0,10) are wrong calls.
Explanation:
The code is
- <em>public static void showProduct (int num1, double num2){</em>
- <em> int product;</em>
- <em> product = num1*(int)num2;</em>
- <em> System.out.println("The product is "+product);</em>
- <em> }</em>
showProduct is function which asks for two arguments whenever it is called, first one is integer and second one is of type double which is nothing but decimal point numbers. Generally, in programming languages, 10 is treated as integer but 10.0 is treated as decimal point number, but in real life they are same.
If showProduct( 10,10.0) is called the output will be 'The product is 100'.
Strange fact is that, if you enter showProduct(10,10.5) the output will remain same as 'The product is 100'. This happens because in the 3rd line of code,which is <em>product=num1*(int)num2</em>, (int) is placed before num2 which makes num2 as of type integer, which means whatever the value of num2 two is given, numbers after decimal is erased and only the integer part is used there.
This is necessary in JAVA and many other programming languages as you <u>cannot</u><u> multiply two different datatypes</u> (here one is int and another is double). Either both of them should be of type int or both should be of type double.
Answer:
- <u>1,000W</u> (rounded to one significant figure)
Explanation:
I will answer in English.
The question is:
- <em>What is the power of a filament lamp that connects to the 220 V network, knowing that it has a resistance of 50 ohms?</em>
<em />
<h2>Solution</h2>
<em />
<em>Power</em>, <em>voltage</em>, <em>resistance</em>, and current, are related by either of the following equations:
Where:
- R is resistance in ohms (Ω)
- V is voltage in volts (V), and
- I is current in amperes (A)
Since you know the voltage (<em>220V</em>) and the resistance (<em>50Ω</em>), you can use the last equation:
Since the magnitude 50Ω has one significant figure, your answer should be rounded to one significant figure. That is <u>1,000W.</u>