Question
Write a Kotlin program that can create user profiles and display profile information for a mobile app called KotlinBuddies. Create a User class that can
Write a Kotlin program that can create user profiles and display profile information for a mobile app called KotlinBuddies. Create a User class that can be used to enter a user name, age, proficiency, and a collaborator. The fields user name and age should be mandatory, i.e., can not be null, while proficiency and collaborator should be non-mandatory, i.e., can be null. Proficiency can take one the following values: Novice, Intermediate, Advanced, and Expert. Write a displayUserInformation( ) function within the user class that can display all user information for a given user as a user summary. If the user doesnt enter a non-mandatory field, the sentence corresponding to that field should be omitted from the output of this function. See my main( ) function and sample output of program below for examples of displayUserInformation( ) output. Test your program by writing a main( ) function like the one shown below. You may use the same user profiles as the ones below. sample main function fun main() { val andrey = User("Andrey", 50, "Expert", null) val jackie = User("Jackie", 40, "Novice", andrey) val mark = User("Mark", 45, null, jackie) andrey.displayUserInformation() jackie.displayUserInformation() mark.displayUserInformation() }
sample output Andrey is a 50 years old Kotlin programmer! Andrey's proficiency level is Expert. Andrey doesn't have a collaborator! Jackie is a 40 years old Kotlin programmer! Jackie's proficiency level is Novice. Jackie collaborates with Andrey, who has a proficiency level of Expert. Mark is a 45 years old Kotlin programmer! Mark collaborates with Jackie, who has a proficiency level of Novice.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started