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

Assignment Help:

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.


Related Discussions:- Creates an object and prompt the user to enter the name

how to store multidimensional array in a single column in m, how to store ...

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

Create a fraction calculator program, You need to create a Fraction calcula...

You need to create a Fraction calculator program.You need to create a Fraction class to represent fraction objects and a FractionCalculator class that will perform operations on fr

C# xna game project, I need to finish my game project within two weeks usin...

I need to finish my game project within two weeks using XNA. Would you guys can help me to finish it? Thank you

Java, what is the difference between class and interface

what is the difference between class and interface

Algorithm and data structure, Man, i''m having quite a problem with this ex...

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

Formulas, how do I change a existing formula with a new formula and it show...

how do I change a existing formula with a new formula and it show the result

What is cisc & risc?, Question 1 What is CISC & RISC? Explain their addres...

Question 1 What is CISC & RISC? Explain their addressing modes Question 2 Discuss the following- Design Specification of Assembler Design of Single Pass Assembler

Irc or internet relay chat application, Programming Project Specification: ...

Programming Project Specification: IRC or Internet Relay Chat is an application that lets multiple users communicate via text messages with each other in common "virtual" rooms.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd