2. Set Collection Given the following sets of students find the following as given. math = {"Juan","Carlo","Cynthia", "Marc","Lucio","Carla"} english = {"Carlo","Marc","Carla","Tina"} 1. How many enrolled in: a. math b. english. c. both subjects 2. List all the students 3. Who are the students enrolled only in math but not in english

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter3: Performing Calculations With Formulas And Functions
Section: Chapter Questions
Problem 3.10CP
icon
Related questions
Question
2. Set Collection
Given the following sets of students find the following as given.
math = {"Juan","Carlo","Cynthia","Marc","Lucio","Carla"}
english = {"Carlo","Marc","Carla","Tina"}
1. How many enrolled in:
a. math
b. english
c. both subjects
2. List all the students
3. Who are the students enrolled only in math but not in english
4. Who are the students enrolled only in english and only in math but not both
subjects
fun main() {
val math = setOf <String>("Juan", "Carlo", "Cynthia", "Marc", "Lucio", "Carla")
val english = setof<String>("Carlo", "Marc", "Carla", "Tina")
println("There are ${//insert code} students enrolled in math")
println("There are ${//insert code} students enrolled in english")
println("There are ${(//insert code} students enrolled in both subject")
println("List of all students\n${//insert code}")
println("List of math students only\n${//insert code}")
println("List of students not in both subjects\n${//insert code}")
}
Program Output
There are 6 students enrolled in math
There are 4 students enrolled in english
There are 3 students enrolled in both subject
List of all students
[Juan, Carlo, Cynthia, Marc, Lucio, Carla, Tina]
List of math students only
[Juan, Cynthia, Lucio]
List of students not in both subjects
[Juan, Cynthia, Lucio, Tina]
Transcribed Image Text:2. Set Collection Given the following sets of students find the following as given. math = {"Juan","Carlo","Cynthia","Marc","Lucio","Carla"} english = {"Carlo","Marc","Carla","Tina"} 1. How many enrolled in: a. math b. english c. both subjects 2. List all the students 3. Who are the students enrolled only in math but not in english 4. Who are the students enrolled only in english and only in math but not both subjects fun main() { val math = setOf <String>("Juan", "Carlo", "Cynthia", "Marc", "Lucio", "Carla") val english = setof<String>("Carlo", "Marc", "Carla", "Tina") println("There are ${//insert code} students enrolled in math") println("There are ${//insert code} students enrolled in english") println("There are ${(//insert code} students enrolled in both subject") println("List of all students\n${//insert code}") println("List of math students only\n${//insert code}") println("List of students not in both subjects\n${//insert code}") } Program Output There are 6 students enrolled in math There are 4 students enrolled in english There are 3 students enrolled in both subject List of all students [Juan, Carlo, Cynthia, Marc, Lucio, Carla, Tina] List of math students only [Juan, Cynthia, Lucio] List of students not in both subjects [Juan, Cynthia, Lucio, Tina]
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
External Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage