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

  Determine the first two lines of the new file

Determine the first two lines of the new file created by the code below. This exercise refers to the file Justices.txt that contains data about the Supreme Court justices, past and present.

  Write a program to calculate the body fat of a person

One way to determine how healthy a person is by measuring the body fat of the person. Write a program to calculate the body fat of a person.

  Create a class for working with mixed fractions

Create a class for working with mixed fractions. Only 3 private data members are needed: the int whole number part of the fraction, the int numerator of the fraction, and the positive int denominator of the fraction

  Write a program that substitutes an overloaded

Write a program that substitutes an overloaded += operator for the overloaded + operator in the STRPLUS program in this chapter.

  Create the structure with 3 members and fill in data

Create a function that will display() all the data for each member and call it from the main program.

  Write a main program to call a procedure

Write a main program to call a procedure that converts the Fahrenheit temperature value stored in the location labeled TdegF to its Celsius equivalent. The range of temperatures is 32°F to 212°F

  Users selection and return to menu

Create a menu that will allow the user to list all wines by name in alphabetic order and count all wines in each type and list all 5 types with their count

  Has public variables of the type float called numerator

Has public variables of the type float called numerator, denominator and total. Has a method called 'Add' that returns the sum of numerator and denominator and sets the total variable.

  Design your program to perform the required tasks

Design and develop a console program that receives inputs from user and display correct outputs and manipulate arithmetic calculation via programming

  Write down a program to print a business travel expenses

write a program to print a business travel expenses attachment for an income tax return. the program should request as

  How to analyze the data

What kind of tools can help you to accomplish that

  Design program which ask the user for positive interger

Design a program which ask the user which application to do: after choosing from factorial or triangle(magicSquare), the program must then ask again the user for a positive interger.

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