?
Solved

errors for testing for a class

Posted on 2005-03-03
3
Medium Priority
?
214 Views
Last Modified: 2010-04-17
Good Afternoon,
pls i need help in compiling this program when i tried to compileing the REGISTER INTERFACE CLASS  it keeps giving me a kick in the teeth i have listed all the program that i have done including the errors. can someone pls help with my errors.
thanks for your help.
       
    H:
    symbol  : constructor RegisterInterface  (int)
    location: class RegisterInterface
                r1 = new RegisterInterface(numOfStudents);
                         ^
    H:java:120: cannot resolve symbol
    symbol  : method option1  (RegisterInterface)
    location: class RegisterInterface
                                 case '1':option1(r1); break;
                                                  ^
    H:java:121: cannot resolve symbol
    symbol  : method option2  (RegisterInterface)
    location: class RegisterInterface
                                    case '2':option2(r1); break;
                                                       ^
    H:java:122: cannot resolve symbol
    symbol  : method option3  (RegisterInterface)
    location: class RegisterInterface
                           case '3':option3(r1); break;
                                        ^
    H:java:123: cannot resolve symbol
    symbol  : method option4  (RegisterInterface)
    location: class RegisterInterface
                                    case '4':option4(r1); break;
                                                       ^
    H:java:124: cannot resolve symbol
    symbol  : method option5  (RegisterInterface)
    location: class RegisterInterface
                                    case '5':option5(r1); break;
                                                       ^
    H:java:125: cannot resolve symbol
    symbol  : method option6  (RegisterInterface)
    location: class RegisterInterface
                                    case '6':option6(r1); break;
                                                       ^
    H:java:126: cannot resolve symbol
    symbol  : method option7  (RegisterInterface)
    location: class RegisterInterface
                                    case '7':option7(r1); break;
                                                       ^
    8 errors
   
     ----jGRASP wedge2: exit code for process is 1.
     ----jGRASP: operation complete.

import EasyIn;

public class RegisterInterface
{
   public static void main (String[]args)
      {
         //declare variables
            char  choice;
            int numOfStudents;
            RegisterInterface r1;
            
            //get size of list
            System.out.print("How many students on the register");
            numOfStudents = EasyIn.getInt();
            
            // create list
            r1 = new RegisterInterface(numOfStudents);
            
            // menu
            
            do
            {
            //display options
                    System.out.println("\n**********    Welcome    **********");
              System.out.println("                                   ");
              System.out.println("                                   ");
              System.out.println("[1]  Add a new student              ");
              System.out.println("[2]  Remove an student              ");
              System.out.println("[3]  Enquire fees due of a student  ");
              System.out.println("[4]  Pay fees by a student with a given amount");
              System.out.println("[5]  Enqiure the total fees due");
              System.out.println("[6]  Display all student details");
              System.out.println("[7]  Sort students according to fees due");
              System.out.println("[0]  Exit the program ");
              System.out.println("\n Enter a choice [1,2,3,4,5,6,7]: ");
              choice = EasyIn.getChar();//get choice
                         
                          switch(choice)
                          {
                             case '1':option1(r1); break;
                                case '2':option2(r1); break;
                       case '3':option3(r1); break;
                                case '4':option4(r1); break;
                                case '5':option5(r1); break;
                                case '6':option6(r1); break;
                                case '7':option7(r1); break;
                                case '0':System.out.print("\n\nExit");break;
                                default: System.out.print("\n 1-7 only");
                          }
                         
            }   while (choice != '0');
   }
}



public class Register
{
   private Student[] students;
   private int numOfStudents;
     private int maxSize;

//Constructor
   public Register(int maxSize)
   {
      students = new Student[maxSize];
      numOfStudents = 0;
   }

 
   
     public void addNewStudent(Student counter)
   {
     
      if(numOfStudents < students.length)
      {
         students[numOfStudents] = counter;
         numOfStudents ++;
          }
     
   }
     
   
     
     public int findStudent(int idNumber)
     {
        int position = -1;
          int index = 0;
          boolean hasFound = false;
         
          while(index< numOfStudents && !hasFound)
          {
             if(students[index].getID()==idNumber)
                 {
                   // a match has found
                     hasFound = true;
                     position = index;
                 }
                 index++;
          }
         
          return position;
     }
     
                 
     
   public void removeStudent(int idNumber)
     {
        int position = findStudent(idNumber);
          {
             if(position!=-1)
               {
                  for(int i = position;i<numOfStudents -1; i++)
                    {
                      students[i] = students [i+1];
                    }
                   
                    // the student is removed so update
               students[numOfStudents] = null;
               numOfStudents = numOfStudents -1;
             }
           }
      }            
                     
       public void descendingFees()
       {
         Student temp;
           
                for (int i =0;i< numOfStudents -1;i++)
                    {
                       for(int j=0;j< numOfStudents;j++)
                         {
                    // check if swap has to take place                    
                            if(students[j].getFeesDue()<students[j+1].getFeesDue())
                              {
                                 // yes so swap position of element being checked
                                 temp = students[j];
                                 students[j]=students[j+1];
                                 students[j+1] = temp;
                            }
                 }          
                }
       }              
         
       public void displayStudentDetails()
       {
          for(int i =0;i<numOfStudents;i++)
            {
               if(students[i] !=null)
                 {
                    students[i].toString();
                 }
            }
     }        
       
       
       public double getFeesDue(int id)
       {
          //locate the student with id
            int position = findStudent(id);
           
            for(int i = 0; i < numOfStudents;i++)
            {
               //an student is returned if position is valid
               //if not return null
               if(position !=-1)
                 
                      return students[position].getFeesPaid();
            }
           
            return -1;
       }
       
                               
      public void payFees(int id, int amount)
        {
         
             int position = findStudent(id);
           
             if((position!=-1)&&(students[position]!=null))
             {
                students[position].payFees(amount);
               }
          }            

          public double getTotalAmountOfFeesDue()
          {
             double total = 0;
               
               for(int i = 0; i < numOfStudents;i++)
               {
                  if(students[i]!= null)
                       total = +  students[i].getFeesDue();
               }
               return total+numOfStudents;
          }              
                   
           
     public void checkOption()
     {
         int option = 0;
           
         if(option < 1 && option > 7)
         {
            System.out.println("Invalid option pls re-enter");
         }
     }  
                 
}

abstract class Student
{  
    //Attributes
    private String name;
    private int idNumber;
    private double amountOfFeesPaid;
     
     
     
          //constructor method
      public Student(String nameIn, int idNumberIn)
      {
            name = nameIn;
                idNumber = idNumberIn;
                amountOfFeesPaid = 0;
      }
     
        public int getID()
        {
           return idNumber;
        }      
           
      public void payFees(double amountIn)
      {
            amountOfFeesPaid = amountOfFeesPaid + amountIn;
      }
     
     
      abstract public double getFeesDue();// an abstract method
     
     
          public String getName()
      {
           return name;
      }
     
         
          public String toString()
      {
             return    "Student name:"
                         + getName()
                               +"Student ID Number:"
                               + getID()
                               +"Amount of fees paid:"
                               + getFeesDue()
                               +"\n";
      }
     
        public double getFeesPaid()
      {
           return amountOfFeesPaid;
      }
         
                   
          public void setFeesPaid(double feesPaid)
          {
         amountOfFeesPaid = feesPaid; // + getFeesDue()  

          }  
}

                 
     

//class declaration
class FullTimeStudent extends Student
{
   
      //Attributes
      private double courseFee = 3000;
     
     
      //parameterised constructor
      public FullTimeStudent(double courseFeeIn)
      {
          super((String)null,(int)0);
          courseFee = courseFeeIn;
      }
     
               
        public double getFeesDue()
      {
        return courseFee-getFeesPaid();
      }
         
          public void PayFees(double amount)
          {
            setFeePaid(getFeesPaid()+amount);
            if(getFeesDue()== 0);
            //setStatus(true)
      }

}      
class PartTimeStudent extends Student
{
   
      //Attributes
      private double numberOfModules;
      private double feePerModule = 300;
         
         
     
      public PartTimeStudent( double numberOfModulesIn,double feePerModuleIn)
          {
         super((String) null, (int)0);
         numberOfModules = numberOfModulesIn;
         feePerModule = feePerModuleIn;
      }

     
       
        public void payFees(double amount)
        {
             setFeePaid(getFeesPaid()+amount);
             if(getFeesDue()== 0);
             //setStatus(true)
      }
 
                                                                     
      public double getFeesDue()
      {
          return  (numberOfModules * feePerModule)-getFeesPaid();
     
     
      }
}      
0
Comment
Question by:pete1981
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

Accepted Solution

by:
InteractiveMind earned 1000 total points
ID: 13451833
You haven't declared the methods:

  option1()
  option2()
  etc..

You also have not declared the constructor RegisterInterface(int)

>> IM
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's recap what we learned from yesterday's Skyport Systems webinar.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question