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
Man, i''m having quite a problem with this exercise. Even googled for Roman multiply table concept. I just don''t get it. Multiply two numbers given in Roman figures. For instan

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

1.  A function that produces the Collatz sequence and counts the number of terms. 2.  A main function that calculates interesting values about the Collatz sequence. 1.The Col

W.A.S.S to find the maximum of three numbers Program # W.A.S.S to find the maximum of three numbers echo "Enter three No.:" read no1 read no2 read no3 if test $no1 -gt $n

Introduction Each module of the course includes a programming project. However, for Modules 5 and 6 we will do a single project to cover both. The purpose of the programming p

One of the main strengths of the Perl programming language are its powerful text manipulation features. In this assignment, you will put them to use for writing a Perl program tha

Describe URL and hostname part? The hostname part of the URL should be a valid Internet hostname. It can also be an IP address like as 204.29.207.217 or 128.235.252.184. The

Write a program to use a robot to move the stack of blocks from a source location to a target location, based. Movement of robot arms, picking and dropping, can be controlled usi

A deterministic finite automaton (DFA) is an abstract machine that reads input from a serial (nonreversible) stream and changes between a finite number of  states according to the

Perform Dbscan Clustering and K means I have a simple array of data. I need to perform dbscan clustering and k means based on the values in the array.detailed description  bel