Homework 7 -- Structs & Conditional Data
Draw from https://pages.github.khoury.northeastern.edu/2500/2024F/hw/hw5.html and https://pages.github.khoury.northeastern.edu/2500/2024F/hw/hw7.html
(Demographic problems)
Introduction
You're working for a university's enrollment system to track student diversity and academic information. The university wants to better understand their student body demographics. You'll be designing data structures and functions to represent and analyze student information. Throughout this assignment, you'll work with structured data definitions to represent student demographics and academic records.
Problem 1
Design a data definition called StudentRecord
that represents a student with the following information:
- Student name (String)
- Age (Number)
- Major (String)
- GPA (Number)
Problem 2
Write a function generate-report that takes a StudentRecord
and produces a comprehensive String report including all relevant information formatted in the following format:
Name: <Student name>
Age: <Age> years old
Major: <Major>
GPA: <GPA>
Problem 3
The university tracks student demographics using these categories:
- International students
- Domestic students from underrepresented groups
- Domestic students from well-represented groups
- Students who prefer not to disclose
Design a conditional data definition called DemographicStatus
that represents these four categories. Some categories need additional information:
- International students need their country of origin (String)
- All domestic students need their home state (String)
- Students who prefer not to disclose need no additional information
Problem 4
Create a new data definition StudentProfile
that combines a StudentRecord
with a DemographicStatus
. This represents complete information about a student.
Problem 5
Design a function count-international
that takes a list of StudentProfiles
and returns the number of international students.
Problem 6
Design a function high-achievers
takes a list of StudentProfiles
and returns a list containing only students with GPA above 3.7.