How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask ATLProg Your Own Question

ATLProg
ATLProg, Software Engineer
Category: Homework
Satisfied Customers: 9151
Experience:  Expert in Java C++ C C# VB Javascript Design SQL HTML
44910485
Type Your Homework Question Here...
ATLProg is online now
A new question is answered every 9 seconds

I need help with a java program

This answer was rated:

I need help with a java program


A.
1. Create a new class called Hamster that includes the functionality below
2. The new class has the attributes of:
name – hamster’s name, type String
age – age of hamster in months, type integer
weight – weight of hamster in pounds, type double
color - type hamster’s color, type String
vaccinated - type boolean - true if hamster was vaccinated, false if not
3. Be sure your classes have a good set of accessor and mutator methods. Every member variable must have at least one independent accessor and one independent mutator.
4. Example:
public void setName(String name) mutator used to set name public void seAge(int age) mutator used to set the age
//.... Add other mutator methods here
public String getName() accessor used to get name public int getAge() accessor used to get age
//.... Add other accessor methods here
Ensure you use the “this” reference from within this class when referring to every instance variable or instance method of the current object.


B.
Write a driver program that reads in 3 pets of type Hamster and prints out the name, age and weight of all not vaccinated Hamster objects that are 4 or more months old. The following information should be read per Hamster in:
name
age weight color vaccinated


Conditional statements should be used to decide which Hamster’s information should be printed.
Use accessor methods to check the age and vaccination status on each Hamster.


The following is a sample of how the output session of the code should look like.
Enter the name of Hamster1: chip
Enter the age of Hamster1 in months: 1
Enter the weight (in pounds) of Hamster1: 2 Enter the color of Hamster1: grey
Is Hamster1 vaccinated? true or false?: true Enter the name of Hamster2: munk
Enter the age of Hamster2 in months: 4
Enter the weight (in pounds) of Hamster2: 1.5 Enter the color of Hamster2: white
Is Hamster2 vaccinated? true or false?: true Enter the name of Hamster3: bluetooth
Enter the age of Hamster3 in months: 5
Enter the weight (in pounds) of Hamster3: 2.5 Enter the color of Hamster3: red
Is Hamster3 vaccinated? true or false?: false
The un-vaccinated hamsters over 4 months old are: Name: bluetooth
Age: 5
Weight: 2.5

Hello Welcome. Thank you for your question, I’m ATLProg and I’ll try to help you.

Pls stay here, I will send answer in next few minutes
THIS ANSWER IS LOCKED!

You need to spend $3 to view this post. Add Funds to your account and buy credits.
ATLProg and other Homework Specialists are ready to help you
Customer: replied 3 years ago.

I tried to compile and is giving me quite a few errors

Youu need to place both files in one folder before compiling and running
Customer: replied 3 years ago.

How do I pick you as the expert I want?


Please start your question text with "For ATLProg Only" to request me again, next time you need help!
http://www.justanswer.com/homework/expert-atlprog/ - Please bookmark this link to ask new question.