spegram91 / Java2JavaScript-Lab-2

Convert Java lab to JavaScript #2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Instructions

Use the provided html/css/js files and folders to implement the following instructions.

Part 1:

Create a program that asks the user how many pets they have. Once you know how many pets they have, ask them what kind of pet each one is, along with each pet's name. For now your program should just hold onto the user input and print out the list at the end; we'll modify this in part 3.

Part 2:

Create a Pet class, and a subclass for each type of pet that you want your program to support. Your classes should follow the following requirements:

  • You must support at least three types of pets.
  • Dog must be one of the types you support.
  • Cat must be one of the types you support.
  • The Pet class must have a speak method that each subclass overrides.
  • The Pet class must have a name field with setters and getters.

Part 3:

Modify your program from part 1 to use the Pet class and its subclasses. Keep a list of the pets your user lists and at the end of the program print out a list of their names and what they say when they speak.

About

Convert Java lab to JavaScript #2


Languages

Language:CSS 69.7%Language:HTML 29.8%Language:JavaScript 0.6%