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
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

A hardware store sells the following hardware tools: screwdriver, wrench, and tape measure. You are asked to calculate the profit for the store based on the number of tools sold an

This assignment begins software tools and techniques for structuring complex programs. Use it to become familiar with these facilities, and ensure you use the speci?ed concepts in

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

Write a program that takes integer array of 8 elements from user and find the smallest element among them using pointers

(a) (i) What do you meant  by a function? Are functions required when writing a C program? (ii) State one of the advantages to the use of functions. (iii) What do you meant by a

Microsoft Intermediate Language in .NET When you create value in any terminology and gather, it will be changed to an 'Intermediate Language' (Microsoft Advanced Language - MSIL

Internal Audit has been asked by the State to review the activities of  The Commission on Workforce Development. The Commission was established several years ago by the state legis

Write a python script that will take two file names as input (src, dest). Open src reading each line in the file, and replacing any occurrences of name with the string "redacted".

1. CMP and SUB CMP is used for comparing 2 registers by subtraction them from one another, but answer is not saved, whereas SUB subtracts 2 registers and saves the answer.