Current location: Hot Scripts Forums » Programming Languages » Everything Java » Help with a program


Help with a program

Reply
  #1 (permalink)  
Old 01-12-11, 12:05 AM
wajidameen wajidameen is offline
New Member
 
Join Date: Jan 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Help with a program

Hello everyone ... am a network associate and dont have much knowledge on java i need to write a program with following requirements

Write a class declaration to do the following operations on the marks of 15 students scored in a subject, stored in an array

1. to find the sum and average of the marks
2. to find the highest and lowest score in the subject.
3. to sort the marks in the ascending order
4. to count the number of students who scored more than 80.

i have tried to write it
there are certain errors
Code:
import java.io.*;
class MarksOfStudents1{
int marks[]={67,89,49,95,68,80,74,59,55,57,85,92,87,50,83};
for(int i=0; i<=14; i++)
{
System.out.println("Student marks are :"+sub_marks[i]);
}
void sumAverage(){
int sum=0;
double avg=0.0;
for(int i=0;i<14;i++)
{
System.out .println(marks[i]);
sum=sum+marks[i];
avg=sum/15;
System.out.println("marks of students= " +sum);
System.out.println("avg");
}
}
void maximumMminimum(){
System.out.println("Minimum value="+getMinValue(marks));
System.out.println("Maximum value=" + get max value (marks));
}
void sorting(){
for (int i=0;i<14;i++){
for (int j=i+1; j<15; j++){
if(marks[i]> marks[j]){
int x,y;
x=marks[i];
y=marks[j];
marks[i]=y;
marks[j]=x;
}
}
}
System.out.println("Array after sorting in ascending order");
System.out.println();
for (int i=0;i<14;i++)
System.out.println(marks[i]);
}
public static void main(String args[]){
MarksOfStudents ms =new MarksOfStudents();
}
}
can anyone complete it for me plz??

Last edited by UnrealEd; 01-12-11 at 05:08 AM. Reason: fixed [code] tags
Reply With Quote
  #2 (permalink)  
Old 01-12-11, 05:10 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
Complete it: No
Help you complete it: yes

There's no point in giving you a proper working code, it's better to learn and understand what needs to be done to get the program working. If I just give you the code, you probably just copy-paste it (and then hand it over to your boss/colleagues). On the other hand, if you tell us what the errors are, I can guide you to the issue and help you fix it. It's way better to find a solution yourself than copy-paste one.

So, what are the errors?
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks


Last edited by UnrealEd; 01-12-11 at 05:12 AM.
Reply With Quote
  #3 (permalink)  
Old 02-01-11, 02:38 AM
JohnnySaur JohnnySaur is offline
Wannabe Coder
 
Join Date: Sep 2010
Posts: 109
Thanks: 1
Thanked 2 Times in 2 Posts
I agree with UnrealEd it is good to teach you how to catch fish rather than give it to you right away.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Earn up to $276 per signup on Rent A Smile Virtual Assistance Affiliate Program! oscarwhite Job Offers & Assistance 0 11-01-10 04:00 PM
need advice on how i should go about writing this program burning_red_phoenix Everything Java 0 11-06-05 05:46 PM
Help Installing a Program that Uses PHP and mySQL DevilDog The Lounge 0 02-26-05 04:01 PM


All times are GMT -5. The time now is 05:57 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.