week 7 Airport exercise

352 views
Skip to first unread message

insha...@gmail.com

unread,
Sep 18, 2015, 12:27:39 PM9/18/15
to mooc.fi
Hi,

I'm having problems with week _7 exercise _8.

I created an Airplane class with a HashMap as an instance variable to store the planes.In order to add flights I need to create an Airplane object as a parameter to the the addflights method.I don't know how to create an Airplane object using the string input by the user.I would be glad if anyone could throw some light into this problem.My entire code,along with the classes, is pasted below.

Thank you.

*Explain your problem here in English or Finnish*

The link to my work is here: PASTE TMC PASTEBIN LINK HERE
Best regards


Supported languages are English and Finnish

Please use our build in TMC Pastebin when asking questions related to your code  
 
TMC Plugin has built-in code sharing feature. 
In NetBeans, select TMC -> Send code to TMC pastebin. Copy the link you receive and paste it to your message.  

You may use our web interface to share code snippets: http://paste.mooc.fi

elaile...@gmail.com

unread,
Sep 19, 2015, 11:32:48 AM9/19/15
to mooc.fi, insha...@gmail.com
Hi;

I do not know why I can not access your code even though I've solved this exercise, "access is denied". However I'll give you some valuable hints:

1- Make sure to make the airplane class and the flight class so simple; just a couple of instance variables and their getters.
2- Leave the heavy work to the userInterface class where you implement the addAirplane and addFlight etc.
3- You'l have to implement your hashmap planes and hashmap flights in the userInterface.

and know for your question on how-to implement the addFlight method, its better to receive a reader as parmeter, here is an example; 

 addFlight(Scanner reader) {
      // after asking the user to enter the plane id,  assign it like this, Airplane plane = planes.get(id);
     // then depC 
    // then desC
   // then declare a new flight with these values, Flight flight = new Flight(plane, depC, desC);
  // lastly add it to the hashmap; flights.put(flight.toString(), flight);
     }

do not forget to override the toString method in an appropriate way.

Juho Leinonen

unread,
Sep 21, 2015, 5:51:57 AM9/21/15
to mooc.fi, insha...@gmail.com
Hello,

First of all, you are not printing the "Airport panel" part, which makes all the tests fail.

For reading users input and creating an airplane object from that, see the other post.

Feel free to ask for more help if you still feel stuck :)

Best regards,
Juho

elaile...@gmail.com

unread,
Sep 21, 2015, 7:13:26 AM9/21/15
to mooc.fi, insha...@gmail.com
Hello;

Mr. Juho leinonen, why I can't access the codes like in this post for example even though I've solved it?

Jarmo Isotalo

unread,
Sep 21, 2015, 7:14:28 AM9/21/15
to elaile...@gmail.com, mooc.fi, insha...@gmail.com
There is a timeout after which the paste link will be invalidated and is no longer accessible.

--
http://mooc.fi
---
You received this message because you are subscribed to the Google Groups "mooc.fi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moocfi+un...@googlegroups.com.
To post to this group, send email to moo...@googlegroups.com.
Visit this group at http://groups.google.com/group/moocfi.
To view this discussion on the web visit https://groups.google.com/d/msgid/moocfi/d1413abb-0ea0-4cfb-b169-dd51f7011d06%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

elaile...@gmail.com

unread,
Sep 21, 2015, 9:48:55 AM9/21/15
to mooc.fi, elaile...@gmail.com, insha...@gmail.com
But I've noticed that others can view it normally, is there any other way to see the codes?

Jarmo Isotalo

unread,
Sep 21, 2015, 12:00:36 PM9/21/15
to elaile...@gmail.com, mooc.fi, insha...@gmail.com
Right, so we have a few TA's here who can access the paste links eternally. But for other of us there is a time limit. This time limit is in place to make it harder to scrape the forums for partial solutions. However, the time limit is mostly designed for a more interactive help sessions such as IRC so it might be too strict for the Google groups. 

Reply all
Reply to author
Forward
0 new messages