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
Memory Hierarchy for Linux Systems A cache line has one or more valid bit(s), tag entry and list of bytes in a block in one set of a cache, as shown below: If you were

Consider a system that has the following UML models: Use Case for CalculateTotalProjectCost Trigger: End of each month Normal Flow of Events For each project in the pro

HOW CAN I DESIGN A MOBILE WEB BROWSER LIKE OPERA MINI. USING VISUAL BASIC? HELP ME.

how to store multidimensional array in a single column in mysql database using MATLAB?

Advantages of visual basic programming language Visual Basic is an exclusive selection language published by Microsoft Company, so programs published in Visible Basic cannot, e

how much it will cost? i need learn how to make rightsided triangle in forloop

Problem 1 Define the architecture of UNIX operating system with appropriate diagram Problem 2 Define the term inter-process communication. What are several approaches t

Figure is a representation of the solar system. In a basic model of the same concentric orbits planets rotate around the sun. The closer the Planet in less time Sun completes a ful

Companies divide their subtasks of game's development. For large complex games, the development team can vary in size from 20 to 100 or more members. The most represented are artis

This assignment is an individual programming assignment using Perl. It addresses objectives 3, 4, 5 and 8 as listed in the Subject Outline document. The assignment is based on them