I am in a Computer Programming class at school and I was out sick all last week and we got this assignment and I am totally lost because I was not there for the lessons. I am not asking you to code this for me I am asking how I would go about this. The first one involves methods, which I don't get at all..
This is the first part, how would I be able to do this at all? I am not asking you to code this just give me some insite. We are using [url=http://compsci.ca/holtsoft/Turing%204.1.1.zip]Java Ready To Program IDE[/url] and its HSA template for coding.
[spoiler]
i) public static void singHappyBirthday (String name)
ii) public static int daysToHours (int days)
iii) public static int cube (int number)
iv) public static int largest (int num1, int num2, int num3)
v) Write a method called convertToGrade
vi) Write a method called roundNumber
[/spoiler]
The second part I am lost on is this
[spoiler]a) Write a program to fill an array with 50 random integer elements. The random values should be between -100 and 100 inclusive.
b) In a separate loop, loop through the array to find and print the max number, the min number, and the average of all numbers.
[/spoiler]
I have the first part I think
But I have no idea how to do the second part. Any help at all will be very helpful and I am completely lost.
This is the first part, how would I be able to do this at all? I am not asking you to code this just give me some insite. We are using [url=http://compsci.ca/holtsoft/Turing%204.1.1.zip]Java Ready To Program IDE[/url] and its HSA template for coding.
[spoiler]
i) public static void singHappyBirthday (String name)
ii) public static int daysToHours (int days)
iii) public static int cube (int number)
iv) public static int largest (int num1, int num2, int num3)
v) Write a method called convertToGrade
vi) Write a method called roundNumber
[/spoiler]
The second part I am lost on is this
[spoiler]a) Write a program to fill an array with 50 random integer elements. The random values should be between -100 and 100 inclusive.
b) In a separate loop, loop through the array to find and print the max number, the min number, and the average of all numbers.
[/spoiler]
I have the first part I think
// The "Q4" class. import java.awt.*; import hsa.Console; public class Q4 { static Console c; // The output console public static void main (String[] args) { c = new Console (); int[] randomArray; randomArray = new int [50]; int max = -101 for (int count = 0 ; count < randomArray.length ; count++) { randomArray [count] = (int) (Math.random () * 200) - 100; } } // main method } // Q4 class
But I have no idea how to do the second part. Any help at all will be very helpful and I am completely lost.