Design a class named pet which should have the name fields

Assignment Help Programming Languages
Reference no: EM131308422

Design a class 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 is the pet. Example values are "Dog", "Cat", and "Bird". •Age - The age field holds the pet's age. The Pet class should also have the following methods: •setName - The setName method stores a value in the name field. •setType - The setType method stores a value in the type field. •setAge - The setAge method stores a value in the age field. •getName

- The getName method returns the value of the name field. •getType - The getType method returns the value of the type field. •getAge - The getAge method returns the value of the age field. Once you have designed the class, design a program that creates an object of the class and prompts the user to enter the name, type, and age of his pet. This data should be stored in the object. Use the object's accessor methods to retrieve the pet's name, type, and age and display this data on the screen.

Reference no: EM131308422

Questions Cloud

Pay for your living expenses using a credit card : You have just entered college and have decided to pay for your living expenses using a credit card that has no minimum monthly payment. You intend to charge $1000 per month on the card for the next 45 months. The card carries a monthly interest rate ..
Start the business as a partnership : Steven has been your best friend since grade school. You have decided to quit your jobs and start up a bakery together since you both love bread. He insists he wants to start the business as a partnership. You want to persuade him to start up the bus..
Design your own java class that includes three data fields : Design your own Java Class that includes at least 3 data fields, 2 constructors and 4 methods. When designing your class, pick an object that you are familiar with and make it your own, realistic, yet simple design with reasonable data fields and ..
Take for the bond to reach its stated face value : How much will a 31, 600 EE savings bond cost you when you initially purchase it; assume the bond earns 4.91 percent annually, approximately how long will it take for the bond to reach its stated face value?
Design a class named pet which should have the name fields : Design a class 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 is the pet. Example values are "Dog", "Cat", and "Bird".
Internal rate of return exceeds the required return : Which one of the following statements is correct in relation to independent projects? The internal rate of return cannot be used to determine the acceptability of a project that has financing type cash flows. A project with investing type cash flows ..
Write program that prompts the user to enter a phone number : Write a test program that prompts the user to enter a phone number as a string. The input number may contain letters. The program translates a letter (upper- or lowercase) to a digit and leaves all other characters intact.
Does an snmp manager run a client snmp program : Does an SNMP manager run a client SNMP program or a server SNMP program?
Statements is correct in relation to independent projects : Which one of the following statements is correct in relation to independent projects?

Reviews

Write a Review

Programming Languages Questions & Answers

  Explain what can go wrong in resource management on c++

Explain What can go wrong in resource management on c++?

  Create a "exit" button that exits the program

Develop a GUI program that will determine the pay for several employees.

  Write the function day

Write the function day(d, m) where m is an integer from 1 through 12 expressing a month, and d is an integer from 1 through 31 expressing the day part of a date in 2014. The function should return the day name ('Mo', 'Su'.etc)

  Application to inputs five numbers given between a range

Write an application that inputs five numbers, each between 10 and 100, inclusive. As each number is read, display it only if it's not a duplicate of a number already read.

  Program to calculate area of two-dimensional shape

Implement the Shape hierarchy shown in following figure. Each TwoDimensionalShape should contain method getArea to calculate the area of the two-dimensional shape.

  What is the difference between an interpreter and a compiler

What are the general stages in the development of an expert system? What occurs in each stage?

  Subdividing address block among four different customers

The ISP needs to subdivide the address block among four different customers, requiring 29, 28, 27, and 26 hosts respectively.

  Create a console application that will convert a one digit

Use Visual Studio to create a console application that will convert a one digit roman numeral into our current numerical system. The program should continue asking the user for input until the user types quit.

  Write function to take the name of file as one parameter

Write a function named paragraphStats() that takes one parameter:the name of a file. The file contains a single line of text.

  Identify why the two tests fail and correct the code

Your first task in this assignment is to study the given code, identify why the two tests fail, and correct the code.

  Create a class-how to cash goods-give change to customers

Write class called Cashier that directs a cashier how to cash goods and give change to customers. Typical cashier operations are as follows.

  Provide a brief description within comment tags at bottom

Provide a brief description within comment tags at the bottom

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