-3
首先關閉我在這裏新。我不知道是否有人會幫助我,但我希望有人能幫助我。 的事情是我們將有一個關於面向對象的編程,方法和類的java考試,當我們有這個時,我不在那裏,我剛剛收到了考試的圖像,並且我有= 0關於java的知識。我可以做一些基本的Java代碼,但我從來沒有看過那些新的東西。 我們在考試中會有2項任務。我將在下面發佈考試。java面向對象的編程
Task 1.
------------------------------
Class STUDENT
classvariable (private)
lastname, firstname, gender, birthyear of student
constructor
the 4 values will be added to the constructor.the values in the Constructor will be assigned to the class variables.
method toString()
the data from the students (the 4 class variables) will be connected to string and stored in a variable .
Form:
Lastname: Muster
Firstname: Max
Birthyear : 1997
Gender: Male
This Variable will be returned by the Mehod.
Method outputStudentdata()
The string from the method toString() will print out.
Task 2.
-------------------------------
Class SCHOOLCLASS
Classvariable
A suitable container to store a school class with an indefinite number of students (static, Array, ArrayList ...)
Method outputClasslist()
for every student in the classroom the index number of the container and the 4 properties surname, first name, year and Gender will be output (use the method outputStudentdata() from the STUDENT Class!)
Method DeleteStudent()
You can enter the index number of the Student you'd like to delete and the student is then deleted from the container (See Default Output)
Method Classsize()
the Classsize (amount of student in Class) is output. (See Default Output)
Method setStudent()
you can enter the last name, first name, gender and the birthyear of the new student(See Default Output)
a new object of class student will be created.
The method returns the object of the class students back.
Method Main()
Following menu will show up:
What Would you like to do?
0 > Exit
1 > Create new Student and add to Schoolclass
2 > Delete Student from Schoolclass
3 > Show Classlist
4 > Show Classsize
Enter your choice :
You can enter your choice.
your choice will then be executed.
If you enter a not valid number(not 0 - 4), a Errormsg will appear.
The Programm will Loop until the numeric code 0 was choosen.
A message appears to Adoption
It is executed, what You have chosen. Enter a not valid number (not 0-4), an error message appears, the program is repeated until the numeric code when choosing 0 A message appears to Adoption.
我希望有人能解釋我是如何工作的提前
感謝,並請不要認爲我想成爲spoonfeeded。 即時在這裏學習如何做到這一點。 我不想在這個考試中失敗
這對本網站來說不是一個好問題(實際上根本沒有問題),並且會被低估並且很可能會被關閉。請閱讀幫助中心瞭解什麼是一個很好的問題。 –
我想你需要添加更多關於*你究竟是什麼*你不明白的信息,如果你想要任何答案。我很確定人們不會爲你寫一篇教程 - 對不起。堆棧溢出實際上更多的是關於具體的編程問題,而不是關於(儘管與編程有關)的一般問題。 – GameDroids