|It is currently Sat Nov 02, 2024 8:52 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka

Author
farahinsamsudin
Offline
Newbie
Newbie
USER_AVATAR

Joined: Sun Mar 17, 2013 4:47 am
Posts: 0
Blog: View Blog (1)

Archives
- March 2013
array in function
   Sun Mar 17, 2013 5:35 am


Search Blogs



 Post subject: array in function
Permanent LinkPosted: Sun Mar 17, 2013 5:35 am 
i cant compile my coding because a several error. i'm try to find it by change its syntax. but it does not work. can anyone help me?

the question ask to display student name, total marks, and status.

Code:
import java.io.*;
import java.lang.*;


public class Assignment1 {
   public static void main(String[] args) {
      
      String studName[] = {"Aminah Binti Samad", "Putra Bin Abdul", "Muadz Bin Kassim", "Kaisara Binti Dollah", "Rahaman Bin Ismail"};
      int test1[] = {90, 45, 78, 80, 60};
      int test2[] = {40, 80, 78, 95, 93};
      int Marks = {0, 0, 0, 0, 0};
      String[] status = new String[5];
      
      CalculateMarks(test1, test2, Marks);
      DetermineStatus(Marks, status);
      Display(studName, Marks, status);
   }
   
   public static void CalculateMarks(int test1[], int test2[], int Marks[])
   {
      for(int i = 0; i < 5; i++)
      {
         int temptotalMarks = 0;
         Marks[i] = test1[i] + test2[i];
         Marks[i] = temptotalMarks;
      }
      
      
   }
   
   public static void DetermineMarks(int Marks[], String[] status)
   {
      for (int i = 0; i < 5; i++)
      {
      if(0 <= Marks[i] || 20<= Marks[i])
         System.out.print("Cannot sit the final exam");
      else if(21 >= Marks[i] || 25 <= Marks[i] )
         System.out.print("Must sit the 3rd test");
      else if(26 >= Marks[i] || 35 <= Marks[i] )
         System.out.print("Allow to sit the final examination");
      else if(36 >= Marks[i] || 40 <= Marks[i] )
         System.out.print("Excluded from sitting the final examination");
      }
      
   }
   
   public static void Display(String studName[], int Marks[], String[] status)
   {
      for(int i = 0; i < 5; i++)
      {
      System.out.print("\n Student Name : " +studName);
      System.out.print("\n Student Marks : " +Marks);
      System.out.print("\n Student Status : " +status);
      }
      
      return;
   }
}


 Profile  
 


All times are UTC [ DST ]









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com