Skip to content
Snippets Groups Projects
Select Git revision
  • 49a7bfc13bc87c84dadacbd430404f5533011375
  • main default protected
  • submission-4
  • stage-4
  • submission-3
  • stage-3
  • submission-2
  • stage-2
  • submission-1
  • stage-1
  • log4j2-tidy
  • test-2
  • test-1
  • test-pitest-with-lower-versions
  • test-pitest-with-verbose
  • test-pitest-on-CI
  • tag-to-test-CI-2
  • tag-to-test-CI-1
  • full-release-CR
  • fix-syntax
  • multi-release-change
  • check-folder-structure
22 results

Properties.java

  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Properties.java 1.50 KiB
    package com.cm6123.monopoly.game;
    
    
    /**
     * Class for properties.
     */
    public class Properties {
    
        /**
         * The name of the property.
         */
        private final String name;
    
        /**
         * The price of the property.
         */
        private int price;
    
        /**
         * The owner of the property.
         */
        private Player owner;
    
        /**
         * Constructor for property with the name.
         *
         * @param propertyname the name of the property
         */
        public Properties(final String propertyname) {
            this.name = propertyname;
            this.price = 200;
            this.owner = null;
        }
    
        /**
         * Gets the name of the property.
         *
         * @return the name of the property
         */
        public String getName() {
            return name;
        }
    
        /**
         * Gets the price of the property.
         *
         * @return the price of the property
         */
        public int getPrice() {
            return price;
        }
    
        /**
         * Sets the price of the property.
         *
         * @param newPrice the new price to set for the property
         */
        public void setPrice(final int newPrice) {
            this.price = newPrice;
        }
    
        /**
         * Gets the owner of the property.
         *
         * @return the owner of the property, or null if the property is not owned
         */
        public Player getOwner() {
            return owner;
        }
    
        /**
         * Sets the owner of the property.
         *
         * @param player the player to set as the owner of the property
         */
        public void setOwner(final Player player) {
            this.owner = player;
        }
    }