我如何在java中编程,我已经绘制了伪代码 [英] How do I program this in java I have got as far as drawing the pseudo code

查看:79
本文介绍了我如何在java中编程,我已经绘制了伪代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(class)

<< Java Class>>

课程



(变数)

学生:列表

老师:讲师



(方法)

addStudent(学生:学生)

assignTeacher(老师:Lecturer)

getNumberofStudents():void

getTeacher():讲师

removeStudent(学生:学生):void





(class)
<<Java Class>>
Course

(variables)
students: List
teacher: Lecturer

(methods)
addStudent(student: Student)
assignTeacher(teacher: Lecturer)
getNumberofStudents(): void
getTeacher(): Lecturer
removeStudent(student: Student): void


import java.awt.List;
import java.util.ArrayList;
 
interface Person{
public String getName();
}
 

class Course{
  ArrayList students = new ArrayList();

  public addStudent(student: Student){

  }

  void getNumberOfStudents(){

  }
}

推荐答案

转到 http://docs.oracle.com/javase/tutorial/index.html [ ^ ]并完成教程标题为覆盖基础知识的路径。这应该可以帮助你开始。
Go to http://docs.oracle.com/javase/tutorial/index.html[^] and work through the tutorials in the section headed Trails Covering the Basics. That should help you get started.


import java.awt.List;
import java.util.ArrayList;
 
public interface Person{ // make it a public. Is an interface demanded?
  public String getName();
}
 

public class Course{ // also public 
  private ArrayList students = new ArrayList(); // this is private!

  public addStudent(student: Student){

  }

  public void getNumberOfStudents(){ // public method

  }
}





visibillity似乎不太清楚。请阅读该问题。



是否需要界面?这个家庭作业通常没有接口。

对象上缺少成员变量老师 course



控制类(主方法的那个)在哪里?



visibillity seems not to be clear to you. Please read on that issue.

Is the interface demanded? This homework normally comes without interfaces.
The member variable teacher is missing on the object course.

Where is the controlling class (the one with the main method) ?


这篇关于我如何在java中编程,我已经绘制了伪代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆