Creates an object and prompt the user to enter the name, Programming Languages

Design an object definition named Pet, which should have the following fields:

  • name: The name field holds the name of a Pet
  • type: The type field holds the type of animal that a Pet is (e.g. "Golden Retriever", "Himalayan", "Budgie")
  • dob: The dob field holds a reference to a JavaScript Date object representing the date of the pet's birth

The Pet object should also have:

  • A constructor that takes values for all fields as parameters
  • Accessors and mutators for all fields
  • A toStringmethod for the object

Once you have programmed the object definition, write a program that creates an object and prompt the user to enter the name, type, and a month (you may ask for this as a number in the range of 0 to 11), day, and year for the date of birth for the Pet. (Use the JavaScript window.prompt() to get this information from the user.) This data should be stored in the object. Use the toString() method to print the object's data to the browser window.

Posted Date: 2/15/2013 5:46:22 AM | Location : United States







Related Discussions:- Creates an object and prompt the user to enter the name, Assignment Help, Ask Question on Creates an object and prompt the user to enter the name, Get Answer, Expert's Help, Creates an object and prompt the user to enter the name Discussions

Write discussion on Creates an object and prompt the user to enter the name
Your posts are moderated
Related Questions
The ATM will simulate a real world automated teller machine that supports safe access to accounts from multiple concurrent clients.

ADO. NET ADO.NET (ActiveX Information Things for .NET) is a set of programs elements that developers can use to accessibility data and data solutions. It is an element of the platf

A charitable organization wants to design a special ATM machine to be used by needy people. The association supplies the needy person with a pin number to be able to use the ATM

A large offshore accommodation barge is to be converted into a floating luxury hotel.  It will be connected to a single point mooring buoy (SPM) in a beautiful inland loch where th

Carnivorous Carla only eats pizza if it has at least three of the following ingredients: ham, pepperoni, salami, italian sausage, bacon. You have the function contains() to check w

Hi I have an assignment for prolog languagle is it possible to get help

Write a function drawCA(aname, coords) that uses the plot3 command to draw the C α backbone of the protein. When calling this function, you should pass in the aname and coords var

Implement the "Nuclear Reactor" example using the following:  An ISR triggered by a button press  A task to update the temperatures  A semaphore to communicate between the ISR and

Attributes to Elements Create an XSLT stylesheet that converts all attributes found in a given XML document to elements.Use the sample instance from question 2 to test the tra

Tamagochi were all the rage in the 90's as a small toy that had limited functionality but modelled a pet. The "owner" could do the following • Feed the pet • Heal the pet