hi everybody,,,

please i need your help in my project if you don't mind
my project is to create an array with size of 10 that allow you to inter 10 students, their id number and thier marks and show the average of the marks as a,b,c,d,and f thats it,,,
please i need it today, i still have just 4 hours to submit it, please do it as soon as you can...

## All 21 Replies

Okay. Finished. Let me see yours.

We are not going to do it for you. And you weren't given this assignment 4 hours ago. I am sure you have been given plenty of time to study and do it. Even plenty of time to come here and ask for help.

Had you come here sooner you would have been given plenty of help and time to do it on your own. But now you will receive the same advices. It is up to you to finish it.

So:
First create a class, let's say it: Student. It will have attributes: id and mark. Create get, set methods.
Then in a main method create an array of students, loop it and read from the keyboard the id and mark of each student. Use the Scanner class and search for examples on how to use it.

I am sure that you have notes on how to create a class.

``````Student [] stds = new Student[10];
for loop {
stds[i] = new Student();
}``````

Then loop again the array, calculate the average and by the use of if statements print A or B or C or .....

i have wrote the code but still missing the if statment i don't know where should i put please help me
see my coad then show me where to put the if statment ok?

I can code it for you.

I assume you are basically wrong by not creating a structure for one student - a Java class named Student for instance.

You can calculate the avg at the end of your algorithm!

Post your code using code tags. And the idea is for you to calculate the average based on the input. Not ask the user to enter it. While you get the grades, add them then divide by 10 to get the average.

Then if the grade is lower than a number and greater than another then print the letter. That will be your if statements. Map the letter grades with the numbers

javaadit i don't force you to help me thats up to you, by the way i have wrote the code but still if statement and thanks for your comment
good luck and god plus you,,,
thank you again

``````import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner scan= new Scanner(System.in);
int size = 10;

String [] name = new String[size];

int [] metric_number = new int[size];

double [] average = new double[size];

int count=0;

for (int k=0 ; k<size  ;k++)
{
System.out.println("inter name of student " + (count+1) + " :" );
name[count]= scan.next();

System.out.println("inter metric number of student " + (count+1) + " :" );
metric_number [count]= scan.nextInt();

System.out.println("inter average of student " + (count+1) + " :" );
average[count]= scan.nextDouble();

System.out.println("name of student number " + (count+1) + " : " +  name[count]  +
" \n number : " + metric_number[count]+
" \n average : "+average[count] );

count++;

}

}
}``````

thanks yuri>>>

Well, I really don't know IF I HAVE UNDERSTOOD YOU WELL.

But there is a code for the most probably version...

``````import java.util.Scanner;

public class StudentIterator {
private static final int SIZE = 10;

/**
* @param args
*/
public static void main(String[] args) {
Student students[] = new Student[SIZE];
Scanner scan = new Scanner(System.in);

String scName = "";
int scMNumber = 0, sum = 0;
double avg = 0.0;

for (int i = 0; i < SIZE; i++) {

System.out.print("inter name of student " + i + " :");
scName = scan.next();

System.out.println();

System.out.print("inter metric number of student " + i + " :");
scMNumber = scan.nextInt();

System.out.println();

students[i] = new Student(scName, scMNumber);
}

for (int i = 0; i < SIZE; i++) {
sum += students[i].getMetric_number();
}

if (SIZE != 0) {
avg = sum / (SIZE * 1.0);
System.out.println("Avg is: " + avg);
}

}
}``````
``````public class Student {
private String name;
private int metric_number;

/**
*
* @param name
* @param metric_number
*/
public Student(final String name, final int metric_number) {
this.name = name;
this.metric_number = metric_number;

}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getMetric_number() {
return metric_number;
}

public void setMetric_number(int metricNumber) {
metric_number = metricNumber;
}

}``````

This let you add 10 students by their name and mark; then it displays the avg mark for this 10 students.

thaks alot yuri but an error appear in the code and i cant solve it
i want to use if statment to display the average as a,b,c,d and f

@yuri1969 do you think that you are helping person if you do the task for them? Think about it...
Asking them questions and pointing them in right direction is much better as in doing so they try to solve it (if they are willing to) on their own, they make mistakes but eventually solve the issue and learn a lot in process of doing it.

@ITmajor if there is error showing up then why don't you copy and paste instead of expecting people to run the application and see for them selfs? Providing accurate description of an issue will get you faster and friendlier replies then moaning "I have error"

@yuri1969 do you think that you are helping person if you do the task for them? Think about it...

I completely agree with you, BUT he said he was in the hurry /4hrs till deadline/. So IMHO not giving him a small piece of code would be cruel.

Deadline is something he has to learn to deal with now or he will suffer later. Besides:
1. Any member deadline doesn't mean anything to us. We are not obliged to reply because of that, we do it when we have time and when we can or feel like
2. What was he doing till now that he is left with "only" 4 hour for submission of that coursework?

Ofc I wasn't obligated to do so, I just wanted to help him. Period.

first, i am not a boy
second, i want to thank yuri from my deeper heart
third, sorry yuri i made a mistake there is no error in your code
finally please for one who want to help me do that and if you don't please don,t send any words that hurt me please i am in hurry and i don't have a time still 2 hours please help me,,,

Please help with what? Be specific on what you want, where you have problem or I will close down this thread with hammer of "Do provide evidence of having done some work yourself if posting questions from schoolwork assignments" rule, since you are not progressing with code therefore show no evidence of doing anything beside begging.

I completely agree with you, BUT he said he was in the hurry /4hrs till deadline/. So IMHO not giving him a small piece of code would be cruel.

It doesn't matter if there are 4 hours or 4 minutes left for the deadline. In this forum we don't hand out code. We help them learn. Just posting the code is wrong and the fact that she waited until the last minute is not an excuse.

You just did all the work for her. She was lazy and you did it for her.
She learned nothing and benefited from your effort.

I tried to help her by providing advices and after she posted her code I gave more advice. But giving the code will not be fair for the rest of her classmates that actually did their own work.

And with all that code that you have been given ITmajor you should have put some effort to understand it and learn from it. But instead of trying to understand it so you can learn from it, you keep on asking for more free code.

That is the gratitude that you received yuri1969. She asked you to do more of her work.

What are you going to do at your next assignment?

In this forum we don't hand out code. We help them learn.

I'm a newb here and it looks like I haven't read FAQs properly :/

first, i am not a boy

As in you are female or as in you are not young, as you are sure showing enough immaturity to be a "boy".

second, i want to thank yuri from my deeper heart
third, sorry yuri i made a mistake there is no error in your code
finally please for one who want to help me do that and if you don't please don,t send any words that hurt me please i am in hurry and i don't have a time still 2 hours please help me,,,

This prviding code is not helping. What have you been doing the rest of the time? The partying was just too tempting to give up, huh? Well, I want to see how you're going to handle your next assignment. As that will build on what you were suppossed to learn doing this one. But, since you didn't do it you didn't learn anything, so you're just that much farther behind now. Own up to your behaviour and take the failing grade.

Guys no need to dig further, deadline over. We will see how and if the person will come next time.

@ITmajor next time more effort or you may get flamed again. And I would say double effort if you want to become programmer