Finally got it to work! Thanks a million!
Type: Posts; User: Dr.HughMan
Finally got it to work! Thanks a million!
I'm thinking I have to make a counter and increment it when a module is assigned but I dont know how or where to put it?
Im sorry but I dont understand this.How will it move to the next slot in the array to add the next module?
Here is my code as it stands now;
package Assignment6;
public class Module {
protected
String code;
String title;
Am I heading in the right direction with this?
package Assignment6;
public class Student {
protected String name;
int id;
String programme;
Sorry but I dont understand this.
Thank you for all your suggestions.
Here is my code as it stands now
package Assignment6;
public class Module {
protected
The output im looking for is
Name: John Johnson
ID No.: 123456
Programme: Electronic Engineering
Module Code:EE219
Moule Title:OOP
Result:57.2%
Module Code:EE203
Moule Title:Maths
Thank you that has sorted my Null Pointer Exception error.
The programm now compiles and runs ok but is not outputing the correct information.
package Assignment6;
public class Module {
...
Does this not happen when in my main at
"Module [] modules = new Module [4];" ?
"this.modules[i] = modules[i];" was supposed to assign it?
I believe the null variable is "this.modules"
I think it is null as the constructor does not seem to assign it the array that I pass to it.
In my main of the student Class I create an array of modules with four modules, then the Student constructer is supposed to assign this array(modules) to the array Module [] modules that I declare at...
When I print out this.modules and modules on line 21 I get
"[LAssignment6.Module;@13e8d89
null"
And when I try to print out Module and modules on line 33 I get nothing and it wont let me print...
and this is line 33
Module.display(modules[i]);
Sorry this is line 21
this.modules[i] = modules[i];
When I modify the code to print out contents of line 21
protected String name;
int id;
String programme;
public Module[] modules;
Thanks for the suggestion!
But I still cant see how to fix it. When I print out the modules on line 21 it gives me the addresses of each module in the array. Which only confuses me more:(
Any...
Hi there,
I am trying to do this question as part of an assignment but I just can't get it to work properly.
"Write a class called Module that has a module code, title and a result (e.g. MM105...