A function is required to calculate and dispay the total of 6 numbers. Here is an attempt to code the solution. Redesign it using your knowledge of for loops.
Adapt your solution to Task1.
If the total is greater than or equal to 100, a function named hundred() is called. This displays the message Hundred reached! 100 times.
else if the total is greater than or equal to 50, a function named fifty() is called. This dispays the message Fifty reached! 50 times.
else, the total is displayed as in task 1.
A computer program welcomes a user in the style of a Cowboy in the Wild West.
It then generates a random whole number to control a FOR LOOP eg if the number generated is 10, the loop will iterate 10 times.
Then, it uses the loop to allow the user to enter whole numbers into the program. It will determine the minimum value entered.
When evaluating the minimum number, if it is greater than 0, a function called positive() is called.
Else if it less than 0, a function called negative is called.
Else a function neutral() is called.
The main program has been written.
public static void main(String[] args){
for(int i = 0; i< 5; i++){
welcome();
}
generateLoopCount(); //determineMin() will use this value to control a loop
determineMin(); //use loop counter to enter numbers and determine the minimum
evaluateMin(); //evaluate the minimum and call the correct function: positive(), negative() or neutral()
}
Complete the program so that it works as expected.