Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Feb 23rd, 2005, 8:55 AM   #1
Dannyz
Newbie
 
Join Date: Feb 2005
Posts: 1
Rep Power: 0 Dannyz is on a distinguished road
Wink Need some Java Help Important

Hi all.
Im doing a project and Im stuck on one question.

Aim is to write a program to store and display the marks of ten students. Each student is to be awarded marks for two components, an assignment and exam respectively.

It then asks for randomly generate coursework and exam grades, which I have done. I then need to display average mark for each student. ( Done that also)

Here is my code.
public class student
{
	public static int[] cgrade = new int[10];
	public static int[] egrade = new int[10];
	
	public static void main( String [] args )
	{
		
		person s1 = new person();
		cgrade[0]=s1.course;
		egrade[0]=s1.exam;

		person s2 = new person();
		cgrade[1]=s2.course;
		egrade[1]=s2.exam;
		
		person s3 = new person();
		cgrade[2]=s3.course;
		egrade[2]=s3.exam;
		
  		person s4 = new person();
		cgrade[3]=s4.course;
		egrade[3]=s4.exam;
		
  		person s5 = new person();
		cgrade[4]=s5.course;
		egrade[4]=s5.exam;
		
  		person s6 = new person();
		cgrade[5]=s6.course;
		egrade[5]=s6.exam;
		
		person s7 = new person();
		cgrade[6]=s7.course;
		egrade[6]=s7.exam;
		
		person s8 = new person();
		cgrade[7]=s8.course;
		egrade[7]=s8.exam;
		
		person s9 = new person();
		cgrade[8]=s9.course;
		egrade[8]=s9.exam;
		
		person s10 = new person();
		cgrade[9]=s10.course;
		egrade[9]=s10.exam;
		
		
		
		for(int x=0;x < cgrade.length;x++)
		{
			double average=((cgrade[x]+egrade[x])/2);
			System.out.println("Name: Student"+(x+1)+"| Coursework Grade: "+cgrade[x]+"| Exam Grade: "+egrade[x]+"| Average: "+average+"%");
		}
		   		
  		
		System.exit(0);
	}
}
	class person
	{
		public int course=0;
   		public int exam=0;
   	
   		public person()
   		{
   		course=10+(int) ( Math.random() * 71);
   		exam=10+(int) ( Math.random() * 71);;
   		}
   	
   	}

The thing im stuck on is.

"Display the results for each student , if a student achieves less than 35% in a particular component they must resit that component. Display the classification for each student based on their overall average mark, where the classifications are as follows;1st requires a mark of 70% or more, 2:2 requires 60% or more, 2:2 requires 50% or more, 3rd requires 40% or more and finally an overall average mark of less than 40% results in a fail".

Thank You all
Dannyz is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:44 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC