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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education