Challenge: Design a Contact Class
Oppgave
Swipe to start coding
Create a Contact class to represent a person's contact information for an address book application.
- The
Contactclass must have three private fields:name,phone, andemail. - You must implement a constructor that takes three parameters (name, phone, email) and assigns them to the corresponding private fields.
- Implement a public method named
GetNamethat returns the value of thenamefield. - Implement a public method named
GetPhonethat returns the value of thephonefield. - Implement a public method named
GetEmailthat returns the value of theemailfield.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 2. Kapittel 2
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Suggested prompts:
Can you explain this in simpler terms?
What are the main takeaways from this?
Can you give me a real-world example?
Fantastisk!
Completion rate forbedret til 4.17
Challenge: Design a Contact Class
Sveip for å vise menyen
Oppgave
Swipe to start coding
Create a Contact class to represent a person's contact information for an address book application.
- The
Contactclass must have three private fields:name,phone, andemail. - You must implement a constructor that takes three parameters (name, phone, email) and assigns them to the corresponding private fields.
- Implement a public method named
GetNamethat returns the value of thenamefield. - Implement a public method named
GetPhonethat returns the value of thephonefield. - Implement a public method named
GetEmailthat returns the value of theemailfield.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 2. Kapittel 2
single