CJCoding With Joseph
15free / daySign inCreate account
TitleOpen
542
Private Field with a GetterCreate a class Person with a private field for a name (set through the constructor) and a public GetName() method that returns it.
easyNot startedSolve
543
Getter and Setter MethodsCreate a class Thermostat with a private int field temperature.
easyNot startedSolve
544
Auto-Implemented PropertiesCreate a class Product with two auto-implemented properties: Name (a string) and Price (a double).
easyNot startedSolve
545
Read-Only PropertyCreate a class Circle whose constructor stores a private double radius.
easyNot startedSolve
546
Computed Full Name PropertyCreate a class Contact whose constructor stores a private first name and last name.
easyNot startedSolve
547
Deposit Into a Private BalanceCreate a class Account with a private double balance that starts at 0.
easyNot startedSolve
548
Property With a Private SetterCreate a class Counter with a Count property that has a public get but a private set, so outside code can read it but not change it directly.
easyNot startedSolve
549
Expression-Bodied PropertyCreate a class Rectangle whose constructor stores a private int width and height.
easyNot startedSolve
550
Read-Only FieldCreate a class IdCard with a public readonly string Name field.
easyNot startedSolve
551
Toggle a Private BooleanCreate a class LightSwitch with a private bool isOn that starts false.
easyNot startedSolve
552
Format a Field as a StringCreate a class Battery whose constructor stores a private int level.
easyNot startedSolve
553
Property With a Backing FieldCreate a class User with a private string name backing field and a public Name property.
easyNot startedSolve
554
Computed Boolean PropertyCreate a class Voter whose constructor stores a private int age.
easyNot startedSolve
567
Getter MethodThe Student class stores a private field name set by the constructor.
easyNot startedSolve
568
Auto-Implemented PropertyGive the Book class a public auto-implemented property named Title of type string with both a get and a set.
easyNot startedSolve
569
Read-Only Computed PropertyThe Rectangle class stores private width and height fields set by the constructor.
easyNot startedSolve
570
Backing Field PropertyThe Thermostat class has a private field temperature.
easyNot startedSolve
572
Private SetterThe Product class should expose a Name property that anyone can read but only the class itself can change.
easyNot startedSolve
574
Normalizing Input in a SetterThe Coupon class has a private field code.
easyNot startedSolve
576
Default for Empty InputThe Profile class has a private field name.
easyNot startedSolve
579
Constant FieldThe TimeConverter class should define a public constant DaysInWeek equal to 7 and a method WeeksToDays(int weeks) that returns weeks DaysInWeek.
easyNot startedSolve
580
Static Instance CounterThe Widget class keeps a private static field count that increases by 1 each time a Widget is constructed.
easyNot startedSolve
583
Private Helper MethodThe Calculator class exposes a public method SumOfSquares(int a, int b) that returns aa + bb.
easyNot startedSolve
585
Read-Only Property from ConstructorThe Box class should have a get-only auto-property Size that is assigned once in the constructor and cannot be changed afterward.
easyNot startedSolve
588
Toggling Encapsulated StateThe LightSwitch class has a private bool field isOn that starts false.
easyNot startedSolve
590
Increment with Private SetThe Counter class has a Count property with a public getter and a private setter, starting at 0.
easyNot startedSolve
555
Validate in a SetterCreate a class Student with a private int age.
mediumNot startedSolve
556
Clamp a Property to a RangeCreate a class Volume with a private int level.
mediumNot startedSolve
557
Reject an Invalid SpendCreate a class Wallet whose constructor sets a private double balance.
mediumNot startedSolve
558
Init-Only PropertyCreate a class Config with a string property Name that can be set only during object initialization, by using an init accessor instead of set.
mediumNot startedSolve
559
Encapsulate a ListCreate a class TodoList that keeps a private List<string> of items.
mediumNot startedSolve
560
Count Instances With a Static FieldCreate a class Widget with a private static int count.
mediumNot startedSolve
561
Computed Property With LogicCreate a class Order whose constructor stores a private double total.
mediumNot startedSolve
562
Two Properties, One FieldCreate a class Temperature backed by a private double celsius.
mediumNot startedSolve
563
Average of an Encapsulated ListCreate a class Gradebook that stores scores in a private List<int>.
mediumNot startedSolve
571
Guarding Against NegativesThe Account class has a private field balance.
mediumNot startedSolve
573
Deposit and WithdrawThe Wallet class has a private field balance that starts at 0.
mediumNot startedSolve
575
ToString OverrideThe Fraction class stores private numerator and denominator fields set by the constructor.
mediumNot startedSolve
577
Constructor OverloadingThe Timer class has a private field seconds.
mediumNot startedSolve
581
Validation Method Returning BoolThe User class has a private field age.
mediumNot startedSolve
582
Monotonic OdometerThe Odometer class has a private field miles.
mediumNot startedSolve
587
Temperature Conversion PropertyThe Thermometer class has a private field celsius.
mediumNot startedSolve
589
Derived Boolean PropertyThe Person class has an auto-property Age.
mediumNot startedSolve
564
Encapsulated Bank AccountBuild a class BankAccount from scratch.
hardNot startedSolve
565
Encapsulated StackBuild a class NumberStack that hides a private List<int>.
hardNot startedSolve
566
Encapsulated State MachineBuild a class TrafficLight that hides its current color in a private string starting at "Red".
hardNot startedSolve
578
Immutable Money TypeThe Money class stores two readonly fields, amount (int) and currency (string), set in the constructor.
hardNot startedSolve
584
Roster Behind a Private ListThe Team class hides a private List<string> of member names.
hardNot startedSolve
586
Validated RectangleBuild the Rectangle class with two properties Width and Height.
hardNot startedSolve
591
Inventory Stock ControlThe Inventory class tracks a private field quantity that starts at 0.
hardNot startedSolve