Create a new project named StudentsYourName. This program stores five students and their information. Each student in this university takes four courses at a time. Show all output in an appStudio label (make it big enough to show all your output).
Requirements - your program must meet all these requirements.
Use JS prompts to get all user data. Write on the prompt what the input should look like (eg. MKT - all caps, Tom - cap first, etc).
Use appStudio label(s) for all output
Object constructor named 'Student' that can be used to make new 'Student' objects. Use it to create new 'student' objects.
Each student object will hold all the properties and methods for one student.
Required Object Properties
- ID (unique ID - use 1, 2, 3, etc)
- 10XP extra: Classes (this needs to be able to hold the four courses that a student is currently taking). DO NOT store these in simple variables (such as Class1, Class2, etc). You just have to keep track of the name of the class (you can assume there are no sections and that the same person teaches the course for everyone).
Required Object Methods
Method 'showStudentAll' that takes an ID number, then outputs to an appStudio lable all of the information for the student in the array with that ID number, putting each property on it's own line like this:
ID Number: 2
Classes: MKT 443, FIN 319, COM 210, BIA 479
Method named changeProperty that gets a student ID number and the name of one desired property to change and the value to change it to (using a prompt), and makes the change, then displays all the student information for that student in an appStudio label so the user can see the change was made. Use a switch statement.The user can only ask the function to change one thing at a time. No changes can be made to the classes being taken.
For example, the user might want to change the phone number of the requested student, so would tell the function: phone and provide the new number: xxx-xxx-xxxx.
Method named showMajor that gets a major code (3 letters, eg. BIA) from the user (with a JS prompt) and displays all of the students with that major, first and last names only, one per line, in an appStudio label.
eg. ask for BIA majors, get:
Use an array of objects to store all the student objects.
Hard-code this data for the first three students (ie. don't get the input from the user).
Frank Jones, 402-112-2234, email@example.com, BIA,
Classes are: BIA 375, ACC 401, FIN 319, MKT 443.
Bill Cosentino, 402-334-2837, firstname.lastname@example.org, MKT,
Classes are MKT 443, FIN 319, COM 210, BIA 479.
Mary Clemens, 506-334-3287, email@example.com, BIA,
Classes are ACC 356, FIN 442, BIA 405, MKT 344.
Use a loop to get data for two more students from the user (use a JS prompt). Add them to the end of the array. So you will end up with five students in your array.
Add an appStudio button labeled Show Specific Major that, when clicked, gets a major code from the user (use a prompt), uses the showMajor method to find and display all the students with that major to an appStudio label.
Add an appStudio button labeled Update Student that gets a student ID, a property to change (eg. firstName), and the new data the user wants to put in that field, then makes the requested change and displays all this students' information in an appStudio label so the user can see the change was made.
Display all of the students first and last names and majors in an appStudio label, one per line, using a loop.
eg. Cindy Corritore, BIA
Bill Cosentino, MKT....
Make the constructor with just properties at first (no methods), then create one object and test each property to make sure you can output them like you want.
write one method at a time as a stand-alone function (outside the object) and test each until each one works like you want. Then make a method out of it in the constructor.
put the data into three new student objects
create an array of the first three objects, then use a loop to go through them and see that they all work like you want.
Put all the parts together and test.