Exception in thread "main" java.lang.NullPointerException
We are dealing with objects, not classes. Object2 constitutes a part of object1.
tony narloch wrote:. . . class2 dies/lives with class1. If class1 dies, so does class2. . . .
tony narloch wrote:the YearData class does not possess an ArrayList, only variables.
the City class contains an ArrayList.
tony narloch wrote:Again, we were given a class diagram, and we are expected to do it in a particular way (the multiple constructors being one).
It appears to initialise your fields to values you don't actually want. Why?
Liutauras Vilda wrote:. . . This is your no-args constructor. . . .
tony narloch wrote:Here is the diagram
Unfortunately once an assessment has been issued, it is virtually impossible to change it. I think there are things in that class diagram I would never do.
tony narloch wrote:. . . we MUST follow the class diagram. So you have a coder who is not 100% confident with their skills, combined with a very poorly expressed class diagram. . . . a recipe for disaster.
tony narloch wrote:I spoke to the tutor about it, he said that we MUST follow the class diagram.
No, it is one more thing to add to your list. You are going to spend ages working out why that happened. You are adding, yes, but you have a City object without an overridden toString() method. Look here about toString(). After all the work you did overriding toString(), too.
tony narloch wrote:. . . Hopefully this is one less thing we can cross off the list
We weren't trying to give you a hint; please only see hints where they actually exist. You have however been given an assignment I don't like
tony narloch wrote:. . . I can take a hint.
tony narloch wrote:1) Whenever I run my program, a new file will be created, but no matter what I enter,  is all that is generated.
tony narloch wrote:How can I narrow down the possibilities of what is causing this please
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database