我有一个java程序:
public class Faculty
{
String facultyName;
Double gemavailable;
}
public class Session
{
String coursename;
float noofhours;
ArrayList<Faculty> faculty=new ArrayList<>();
}
public class TrainingInstitute
{
ArrayList<Faculty> faculty=new ArrayList<>();
ArrayList<Session> session=new ArrayList<>();
public void takeASession(String coursename,float hours,ArrayList<Faculty> faculty)
{
Session s=new Session(coursename, hours, faculty);
session.add(s);
}
我的主课看起来像:
public class TrainingController
{
public static void main(String[] args)
{
TrainingInstitute t=new TrainingInstitute();
t.takeASession("java", 5,f1);
}
我的主要动机是通过设置课程名称、参加课程的教师和课程持续时间来创建一个会话对象。并将会话对象添加到培训学院的 sessionTaken 列表中。我该怎么做?