build a student class implement the student class with the following instance variables:  * id * firstName *lastName *dateOfBirth * Major create an __init__ function adn initialize all the fields make the "major" an option field and set a default value to "undefined" create a setter and getter function for all these five variables create another function: "print_student_info()" which prints 5 pieces of information: id, first name, last name, date of birth, and major. Make sure to have proper formatting done for printing these 5 things. Use the student class Task 1: create an empty list named "all_students" Task 2: create a variable named "id" and initialize it to 100 (some default value to start with, next id would be 101) Task 3: ask the user for input "How many students:" Task 4: Now run a for loop based on that input number and do the following things for each iteration: - get input of student's first name, last name, date of birth, and major - user should be able to skip the "major" input if choose to do so. (user simply hit "enter") - once all the inputs are collected, increment the "id" by 1 - then create a student object and pass that 5 information. If "major" input is skipped, pass 4 information instead - insert this object into the "all_students" list Task 5: Now iterate all the objects inside "all_students" and call the function "print_student_info()". Make sure you see all the student's info. Task 6: After that, input a student's "last name" and input "major"/ Once you get these two inputs, search all students by their last name and do the following: - if no match found, then print "No such student found" - if match found, update that student's "major" by the newly entered "major" Task 7: Lastly, do Task 5 again and observe whether specific student info got updated with the new "major" or not.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question

build a student class

implement the student class with the following instance variables: 

* id

* firstName

*lastName

*dateOfBirth

* Major

create an __init__ function adn initialize all the fields

make the "major" an option field and set a default value to "undefined"

create a setter and getter function for all these five variables

create another function: "print_student_info()" which prints 5 pieces of information: id, first name, last name, date of birth, and major. Make sure to have proper formatting done for printing these 5 things.

Use the student class

Task 1: create an empty list named "all_students"

Task 2: create a variable named "id" and initialize it to 100 (some default value to start with, next id would be 101)

Task 3: ask the user for input "How many students:"

Task 4: Now run a for loop based on that input number and do the following things for each iteration:

- get input of student's first name, last name, date of birth, and major

- user should be able to skip the "major" input if choose to do so. (user simply hit "enter")

- once all the inputs are collected, increment the "id" by 1

- then create a student object and pass that 5 information. If "major" input is skipped, pass 4 information instead

- insert this object into the "all_students" list

Task 5: Now iterate all the objects inside "all_students" and call the function "print_student_info()". Make sure you see all the student's info.

Task 6: After that, input a student's "last name" and input "major"/ Once you get these two inputs, search all students by their last name and do the following:

- if no match found, then print "No such student found"

- if match found, update that student's "major" by the newly entered "major"

Task 7: Lastly, do Task 5 again and observe whether specific student info got updated with the new "major" or not.

 

 

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Class
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,