Help me with my JavaScript Prompt assignment. Professor explained horribly and many confused

homework

#1

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

  1. ID (unique ID - use 1, 2, 3, etc)
  2. FirstName
  3. LastName
  4. Email
  5. Major
  6. 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

  1. 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
    Bill Cosentino
    bc@gmail.com
    402-334-2837
    MKT
    Classes: MKT 443, FIN 319, COM 210, BIA 479

  2. 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.

  3. 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:
    Cindy Corritore
    Frank Jones

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, fj@gmail.com, BIA,
Classes are: BIA 375, ACC 401, FIN 319, MKT 443.

Bill Cosentino, 402-334-2837, bc@gmail.com, MKT,
Classes are MKT 443, FIN 319, COM 210, BIA 479.

Mary Clemens, 506-334-3287, mc@gmail.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....
Algorithm

  1. 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.

  2. 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.

  3. put the data into three new student objects

  4. 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.

  5. Put all the parts together and test.


#2

How are you making out with this assignment? It's been a day and nobody seems to be showing any interest. Perhaps let us see what you have so far?

Bear in mind that we won't have the environment (appStudio) that you have so cannot guide you through that process, but we will recognize the vendor specific code.

Yesterday I wrote enough code to satisfy the instructions, but have no environment except the console so it won't be much use on the rendering side. One may be willing to share once we see your code.

I will share some of the outputs, though, just not the source code.

function getStudent(idNumber) {
    students[getIndex(idNumber)].showStudentAll();
}

function getStudents() {
    for (var i = 1; i <= students.length; i++) {
        getStudent(i);
    }
}

 > getStudents()

ID Number: 1
Frank Jones
402-112-2234
fj@gmail.com
BIA
Classes: BIA 375, ACC 401, FIN 319, MKT 443

ID Number: 2
Bill Cosentino
402-334-2837
bc@gmail.com
MKT
Classes: MKT 443, FIN 319, COM 210, BIA 479

ID Number: 3
Mary Clemens
506-334-3287
mc@gmail.com
BIA
Classes: ACC 356, FIN 442, BIA 405, MKT 344
=> undefined
 >

 > students[0].showMajor()
Students with BIA Major

Frank Jones
Mary Clemens

=> undefined
 >

 > getStudentMajors()
Student Majors

Frank Jones BIA
Bill Cosentino MKT
Mary Clemens BIA

=> undefined
 >

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.