Answer:
A)
Explanation:
In this code example the missing piece of code would be...
public void setHourly(String isHourly)
This piece of code is creating a function called setHourly which takes in one String variable as it's parameter. Based on the rest of the code, the function takes that parameter variable and places it into an instance variable called Hourly which can be used when the function is called.
Answer:
public class Main
{
public static void printString(String strText, int intNumber) {
for(int i=0; i<intNumber; i++){
System.out.println(strText);
}
}
public static void main(String[] args) {
printString("Brainly", 3);
}
}
Explanation:
- Define a function called printString that takes two parameters - a String and an int. Since the function will print out the given String, it's type will be void.
- Use for loop to iterate according to the given number and print the given string
- In the main, call the printString function with some parameters.
// Class declaration
public class Printer {
// Define the function and call it printMany
// The return type is void since it doesn't necessarily return any value.
// It just prints to the console.
// It takes two arguments strText of type String and
// intNumber of type int.
public static void printMany(String strText, int intNumber){
// Initialize the loop counter i to 1;
int i = 1;
//Create a while loop that goes
// from i = 1 to i = intNumber.
// Where intNumber is the number of times the string strText
// will be printed.
while(i <= intNumber) {
// At each of the cycle of the loop;
// print out the string strText
// and increment the value of the loop counter by 1
System.out.println(strText);
i++;
} // End of while loop
} // End of method, printMany, declaration
// Write the main method to call the printMany function
public static void main(String[] args) {
// Call the printMany function by supplying sample arguments;
// In this case, strText has been given a value of "Omobowale"
// And intNumber has been given a value of 4
// Therefore, "Omobowale" will be printed 4 times.
printMany("Omobowale", 4);
} // End of main method
} // End of class declaration
When the program above is run, the following will be the output;
----------------------------------------------------
Omobowale
Omobowale
Omobowale
Omobowale
-------------------------------------------------------
Comments:
* The above code has been written in Java
* The code contains comments explaining every part of the code. Kindly go through the comments.
The whole code without comments is re-written as follows;
public class Printer {
public static void printMany(String strText, int intNumber){
int i = 1;
while(i <= intNumber){
System.out.println(strText);
i++;
}
}
public static void main(String[] args) {
printMany("Omobowale", 4);
}
}
Answer:
The formula in Excel is:
=($B$6 - $B$5 - $B$7)* $B$8
Explanation:
Required
Use of absolute reference
To reference a cell using absolute reference, we have to include that $ sign. i.e. cell B5 will be written as: $B$5; B6 as $B$6; B7 as $B$7; and B8 as $B$8;
Having explained that, the formula in cell B13 is:
=($B$6 - $B$5 - $B$7)* $B$8
Answer:
If( on_time == True) {
print("Coffee")
} else {
print("No Coffee")
}
Explanation:
Step 1 evaluate with a boolean variable if you are on time
If( on_time == True) {
Step 2 if true you have coffee
print("Coffee")
Step 3 if false you have not coffee
print("No Coffee")
declared
B.
deallocated
C.
initialized
D.
All of the above
Answer:
A. declared
Explanation:
Before a structure can be used, it must be declared.
For example:
// Structure definition
struct s{
int a;
char b;
};
// Structure instantiation
struct s mystruct;
// This is where a structure instance called mystruct is created whose
// datatype is struct s.
mystruct.a = 10;
mystruct.b = 'c';
As we can see from the example definition precedes use for the structure.
Answer:
Code is provided in the attachment form
Explanation:
Vector Multiplication code:
Vector_multiplication.c file contains C code.
See attachment no 1 attached below
Classification of Algorithm: For creating elements in vector c of size n, number of scalar multiplications is equal to n. The size of original two vectors scales directly with the number of operations. Hence, it is classified as O(n).