Here is a practise revision question that im stuck on:
Q32) Write a program that reads in 10 student marks into an array called marks
and computes the number of students who have failed (got a mark less than 40).
Ok so here is what i have so far:
public static void main(String[] args) {
int[] marks = new int[10];
String strMark = "";
int Marksread = 0;
for (Marksread = 0; Marksread < marks.length; Marksread++){
strMark = JOptionPane.showInputDialog("Enter a Mark:");
marks[Marksread] = Integer.parseInt(strMark);
I have managed to read in the 10 marks but i cant figure out how to display the number of student that have failed. I know i have to use a loop to count it up but just cant seem to get my head round it and keep getting errors Need help please... :s