Alltman
Alltman
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
I will do it likethat
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
What is the command again to send my code?
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
That would be easy but sadly enough that's not the assignment 😦
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
Current output: Key front door with weight 0,500 kg from level 3 fits on door 1. There are 2key(s) in circulation. Key back door with weight 0,500 kg from level 1 fits on door 2. There are 2 key(s) in circulation.
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
Key front door with weight 0,500 kg from level 3 fits on door 1. There are 1 key(s) in circulation. Key back door with weight 0,500 kg from level 1 fits on door 2. There are 2 key(s) in circulation.
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
Expected output:
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
this is the assignment
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
Create the domain class "Tool": -3 properties: name (mandatory, may not be changed), weight (in kg) and level (int) -constructor with 3 parameters (controls see description setter) -constructor with 2 parameters. Level is set to 1 by default here. -getter for each attribute -setter for the attribute:◦weight: must be a positive number, less than 1000 kg◦level: there are 10 levels in the game, numbered from 1 to 10◦no setter for name because name may not be changed. Name may not be null or empty. -ToString Object ... with weight ... (3 digits after comma) kg from level ... Create 2 subclasses: The class "Weapon": -2 extra attributes: force and used -constructor -getters for the extra attributes -setter for each extra attribute:◦force: is a positive number◦used: no check needed -weapons are only available in levels 1 through 5: provide a CheckLevel method for this -ToString (see below for the requested output) The class "Key": -2 extra attributes: door (int), number of the door to which the key fits and numberInOverflow:represents the number of keys present in the game -constructor -getters for the extra attributes -setter for door: must be a positive number -ToString (see below for the requested output) -method PastOp: returns true/false depending on the current key on the door given as a parameter fits or not Cui layer Write an ObjectApplication in which an array of Weapons and an array of Keys are created. Let the application display the objects created.Possible output: Weapon colt with weight 1,500 kg from level 3 and with force 6 not yet used. Weapon brown with weight 0,500 kg from level 1 and with force 23 already used. Key front door with weight 0,500 kg from level 3 fits on door 1. There are 1 key(s) in circulation. Key back door with weight 0,500 kg from level 1 fits on door 2. There are 2 key(s) in circulation.
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
it needs to be key one... there is 1 key, key 2 ... there are 2 keys
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
but output is still key one... there are 2 keys, key two... there are 2 keys
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
A sleutel is a key btw
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
like this
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
public static int AantalInOmloop{get; set;}

public Sleutel(string naam, double gewicht, int niveau, int deur): base(naam,gewicht, niveau)
{
Deur = deur;
AantalInOmloop++;
}
public static int AantalInOmloop{get; set;}

public Sleutel(string naam, double gewicht, int niveau, int deur): base(naam,gewicht, niveau)
{
Deur = deur;
AantalInOmloop++;
}
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
Marked numbers is what the output should be
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
No description
31 replies
CC#
Created by Alltman on 11/22/2023 in #help
I want an attribute to increment each time an instance is created.
public class Sleutel : Voorwerp
{
private int _deur;
public int Deur {
get
{
return _deur;
}
private set
{
if(value < 0)
{
throw new ArgumentException("Deurnummer moet positief zijn");
}
_deur = value;
}
}


private static int _aantalInOmloop;
public int AantalInOmloop
{
get
{
return _aantalInOmloop;
}
private set
{
_aantalInOmloop = value;
}
}

public Sleutel(string naam, double gewicht, int niveau, int deur): base(naam,gewicht, niveau)
{
Deur = deur;
_aantalInOmloop++;
AantalInOmloop = _aantalInOmloop;
}
public bool PastOp(int doelDeur)
{
return Deur == doelDeur;
}

public override string ToString()
{
return $"{base.ToString()} past op deur {Deur}. \nEr zijn {AantalInOmloop} sleutel(s) in omloop.";
}
public class Sleutel : Voorwerp
{
private int _deur;
public int Deur {
get
{
return _deur;
}
private set
{
if(value < 0)
{
throw new ArgumentException("Deurnummer moet positief zijn");
}
_deur = value;
}
}


private static int _aantalInOmloop;
public int AantalInOmloop
{
get
{
return _aantalInOmloop;
}
private set
{
_aantalInOmloop = value;
}
}

public Sleutel(string naam, double gewicht, int niveau, int deur): base(naam,gewicht, niveau)
{
Deur = deur;
_aantalInOmloop++;
AantalInOmloop = _aantalInOmloop;
}
public bool PastOp(int doelDeur)
{
return Deur == doelDeur;
}

public override string ToString()
{
return $"{base.ToString()} past op deur {Deur}. \nEr zijn {AantalInOmloop} sleutel(s) in omloop.";
}
31 replies