Australian Geography and Addresses
10 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the order of the states in the enum class named State?

NEW_SOUTH_WALES, AUSTRALIAN_CAPITAL_TERRITORY, VICTORIA, QUEENSLAND, SOUTH_AUSTRALIA, WESTERN_AUSTRALIA, TASMANIA, NORTHERN_TERRITORY

What parameters does the constructor of the Suburb class take?

String name, String city, State state, String postCode

What is the format of the string returned by the toString method of the Suburb class?

name + : + city + : + state + : + postCode;

What is the purpose of the getPostCode method of the Suburb class?

<p>Returns the postcode of the suburb.</p> Signup and view all the answers

What is the name of the enum class used to represent the states in Australia?

<p>State</p> Signup and view all the answers

What is the maximum length of a suburb's name in the Suburb class?

<p>26 characters</p> Signup and view all the answers

What is the format required for the city name in the Suburb class?

<p>Title case</p> Signup and view all the answers

How many digits must the postcode be in the Suburb class?

<p>Exactly 4 digits</p> Signup and view all the answers

What happens if an invalid state is provided when constructing a Suburb object?

<p>The state is set to 'ERROR'</p> Signup and view all the answers

What is the purpose of the State enum in the Suburb class?

<p>To represent the valid Australian States</p> Signup and view all the answers

Study Notes

Suburb Class

  • The Suburb class has a constructor that initializes an object with a name, city, state, and postcode.
  • The state is represented by an enum called State, which has eight valid values:
    • NEW_SOUTH_WALES
    • AUSTRALIAN_CAPITAL_TERRITORY
    • VICTORIA
    • QUEENSLAND
    • SOUTH_AUSTRALIA
    • WESTERN_AUSTRALIA
    • TASMANIA
    • NORTHERN_TERRITORY

Domain Rules for Suburb Properties

  • Name:
    • Minimum of 1 character in length
    • Maximum of 26 characters in length
    • Must be in title case (e.g. Carlton North)
  • City:
    • Minimum of 1 character in length
    • Must be in title case (e.g. Sunshine Coast)
  • Postcode:
    • Exactly 4 digits in length
    • Must contain only numeric characters
  • State:
    • Must be a valid Australian state (or territory)
    • Invalid values will be set to "ERROR"

Methods in Suburb Class

  • Public methods:
    • public String getName(): Returns the name of the suburb
    • public String getCity(): Returns the name of the city
    • public String getPostCode(): Returns the postcode
    • public String toString(): Returns a string representation of the suburb (e.g. "Carlton North:Melbourne:Victoria:3054")

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your knowledge of Australian states, suburbs, and addresses. Learn about the different states and territories in Australia and how to format addresses correctly.

More Like This

Geography of Australia Quiz
11 questions

Geography of Australia Quiz

AmiableAltoSaxophone avatar
AmiableAltoSaxophone
Australia Geography
8 questions

Australia Geography

EfficientPopArt avatar
EfficientPopArt
Use Quizgecko on...
Browser
Browser