Question: Write a program that takes three names as inputs from the prompt. a. Write a class that contains a constructor that initiate three string properties

Write a program that takes three names as inputs from the prompt.

a. Write a class that contains a constructor that initiate three string properties using the input values. There should be a getter method called classmates that returns two names as classmates. Note that if the getter method is defined correctly, you should not need to use a pair of () after the method names to call them as shown in the textbook. 10 points off if not using a correct getter method.

b. Create an object from the class. Call its getter method and print the names of the two classmates.

JAVASCRIPT ONLY PLEASE

What I have so far:

// Constructor to initialize the properties with input values class Students(name1,name2,name3) { // Assign the input values to the properties this.name1 = name1; this.name2 = name2; this.name3 = name3; }

// Getter method to return the two classmates get classmates() return this.name1 && this.name2 { } } // Prompt the user to enter the students first name Let name1= prompt("Enter first student name."); Let name1= prompt("Enter second student name."); Let name1= prompt("Enter third student name.");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!