Menu

choose appropriate names for identifiers. choose appropriate types for variables. write informative documentation. Task On the theme of travel, think of something that could be represented by a Jav…

Question

Answered step-by-step

choose appropriate names for identifiers. choose appropriate types…

 

  • choose appropriate names for identifiers.
  • choose appropriate types for variables.
  • write informative documentation.

Task

  • On the theme of travel, think of something that could be represented by a Java object.
  • Choose a class-name other than travel.
  • Choose names for the fields in the class. Next, decide on appropriate types for each variable. You must have field-types of int, String, double, char, and boolean.
  • Choose methods for the class. Decide on method-names, return-types, parameter-names, and parameter-types where appropriate. Leave method bodies empty–these methods will not do anything, except return a sample value in order to allow compilation.
  • Write variable and method names in camelCase.
  • Choose method names that follow the verbNoun pattern.
  • Provide a comment above each method to explain what the method would do if it had a body.

Tips

  • Write the solution in BlueJ and then insert a screenshot into this document. This way the code will be colourised and formatted neatly.

OR

Leave a Reply

Your email address will not be published. Required fields are marked *