» »

[Java] Pomoč pri reševanju naloge

[Java] Pomoč pri reševanju naloge

shadeX ::

Ojla.

To temo sem odprl z namenom, da če se mi bo kdaj kaj zataknilo pri določenih nalogah ki jih rešujem pri programiranju. Ker mi je že malce nerodno odpirat vsakič novo temo ko imam nov problem, prosim moderatorje če ne zaklepajo te teme ( ali pa me preusmerijo v drugo, če že obstaja ) Sicer naj povem, da to niso naloge za šolo. Te naloge dobim na internetu in jih sam poskušam rešiti. Včasih me zmotijo čisto majhne malenkosti in mi je nerodno vedno znova odpirat novo temo za kakšne majhne probleme.

Tukaj imam nalogo:

5. a. Create a CollegeCourse class. The class contains fields for the course ID (for example,
“CIS 210”), credit hours (for example, 3), and a letter grade (for example, ‘A’).

Include get() and set()methods for each field. Create a Student class containing an
ID number and an array of five CollegeCourse objects. Create a get() and set()
method for the Student ID number. Also create a get() method that returns one
of the Student’s CollegeCourses; the method takes an integer argument and
returns the CollegeCourse in that position (0 through 4).
Next, create a set()
method that sets the value of one of the Student’s CollegeCourses; the method
takes two arguments—a CollegeCourse and an integer representing the
CollegeCourse’s position (0 through 4).


Tukaj sem naredil vse do tam kjer je označeno odebeljeno. Ne razumem kaj moram tukaj narediti..
Also create a get() method that returns one
of the Student’s CollegeCourses; the method takes an integer argument and
returns the CollegeCourse in that position (0 through 4).


To imam kodo iz Student razreda.

public class Student {
	
	int id;
	CollegeCourse[] cc = new CollegeCourse[5];
	
	
	public void setId(int id) {
		
		this.id = id;
	}
	
	public int getId() {
		
		return id;
	}
	
	public CollegeCourse getCollegeCourse(int arr) {
		
		// kaj točno gre tukaj?
		
		
	}

}


Namigi dobrodošli =)
  • zaklenil: Mavrik ()

Mavrik ::

Odpri vsakič novo temo da bo kdo celo še kdaj našel nasvete, ne pa vse tlačiti v brozgo v eni sami.
The truth is rarely pure and never simple.

Zgodovina sprememb…

  • spremenil: Mavrik ()


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

Udemy free koda za 52 HQ developer tečajev

Oddelek: Programiranje
82982 (2338) matjazd
»

[android] crash

Oddelek: Programiranje
61314 (1123) messi
»

[Java] Objekt poslan k metodi v kakšnem stanju?

Oddelek: Programiranje
211518 (965) shadeX
»

razložitev nekaterij elementov v visual studio 05

Oddelek: Programiranje
72084 (1889) darkolord

Več podobnih tem