Challenge: Create a Book Class
Taak
Swipe to start coding
Practice creating a class with both a default and a parameterized constructor. Your goal is to implement a Book class that can be initialized with or without specifying the title and author.
- The class must have two public string fields:
TitleandAuthor. - The default constructor must set both
TitleandAuthorfields to"Unknown". - The parameterized constructor must accept two string parameters and assign them to the
TitleandAuthorfields, respectively. - Creating a
Bookwithout parameters must initialize it with"Unknown"values. - Creating a
Bookwith parameters must initialize it with the provided values.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 2
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Suggested prompts:
Can you explain this in simpler terms?
What are some examples related to this topic?
Where can I learn more about this?
Geweldig!
Completion tarief verbeterd naar 4.17
Challenge: Create a Book Class
Veeg om het menu te tonen
Taak
Swipe to start coding
Practice creating a class with both a default and a parameterized constructor. Your goal is to implement a Book class that can be initialized with or without specifying the title and author.
- The class must have two public string fields:
TitleandAuthor. - The default constructor must set both
TitleandAuthorfields to"Unknown". - The parameterized constructor must accept two string parameters and assign them to the
TitleandAuthorfields, respectively. - Creating a
Bookwithout parameters must initialize it with"Unknown"values. - Creating a
Bookwith parameters must initialize it with the provided values.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 2
single