The new class has the attributes of: name - type string age

Assignment Help JAVA Programming
Reference no: EM13847810

Here is my current assignment I got the cat file to work I'm just having trouble with the driver file. You must create two Java files called LastNameFirstNameUnit6Prog.java, and Cat.java. Ensure you include ALL files required to make your program compile and run. I would like to see your .java files only. 5% Cat.java Class File Create a new class called Cat that includes the functionality below The new class has the attributes of: name - type String age - type integer weight - type double breed - type String declawed - type boolean - true for has no claws, false for has claws Be sure your classes have a reasonable complement of constructor, accessor and mutator methods. Every member variable must have at least one independent accessor and one independent mutator. Example: public void setName(String name) mutator used to set name public void setBreed(String breed) mutator used to set the breed public void set(Boolean declawed) used to set claws or not (You must overload the set method to set deClawed value) public String getName() accessor used to get name public String getBreed() accessor used to get breed public boolean getBoolean() access used to get the value of declawed Ensure you use the "this" reference from within this class when referring to every instance variable or instance method of the current object. 45% LastNameFirstNameUnit6Prog.java Class File (Driver Program) Write a driver program that reads in 3 pets of type Cat and prints out the name and age of all cats with claws and over 3 years old. The following information should be read in: Name (as String) Age (as int) Weight (as double) Breed (as String) DeClawed (as boolean) Ensure you use the accessor methods to check the age and claws. 45% NOTE: Complete your activity and submit it by clicking on "Submit Assignment". 5% Total Possible Points 100 Example output of your program Example Run: Enter the name of Cat 1: Sam Enter the age of Cat 1: 1 Enter the weight of Cat 1: 5 Enter the breed of Cat 1: fluffy1 Does the cat have claws? True or False?: True Enter the name of Cat 2: Tom Enter the age of Cat 2: 4 Enter the weight of Cat 2: 5 Enter the breed of Cat 2: fluffy2 Does the cat have claws? True or False?: True Enter the name of Cat 3: Bob Enter the age of Cat 3: 5 Enter the weight of Cat 3: 5 Enter the breed of Cat 3: fluffy3 Does the cat have claws? True or False?: False The Cats over 3 with claws are: Name: Tom Age: 4 Years Old public static void main(String[] args) { Scanner input = new Scanner(System.in); //Input Cats name System.out.println("Enter cats name:"); String name = input.next(); //Input Cats age System.out.println("Enter cats age :"); int age = input.nextInt(); //Input Cats weight System.out.println("Enter cats weight :"); double weight = input.nextDouble(); //Input Cats breed System.out.println("Enter cats breed :"); String breed = input.next(); //Input value true or false for Cats claw status System.out.println("Is your cat declawed? (True or False) :"); boolean is_declawed = input.nextBoolean(); //method used to set variables name, age, weight, breed, and claw status for each of 3 Cats Cat myCat1 = new Cat(); myCat1.setName(name); myCat1.setBreed(breed); myCat1.setAge(age); myCat1.setWeight(weight); myCat1.setDeclawed(is_declawed); System.out.println("The Cats over 3 years old with claws are: "); if(myCat1.getAge() >= 3 && myCat1.getIs_declawed()== false) System.out.println("Name: " + myCat1.getName()); System.out.println("Age: " + myCat1.getAge() + " Years Old:"); System.out.println("Enter cats name:"); name = input.next(); //Input Cats age System.out.println("Enter cats age :"); age = input.nextInt(); //Input Cats weight System.out.println("Enter cats weight :"); weight = input.nextDouble(); //Input Cats breed System.out.println("Enter cats breed :"); breed = input.next(); //Input value true or false for Cats claw status System.out.println("Is your cat declawed? (True or False) :"); is_declawed = input.nextBoolean(); //method used to set variables name, age, weight, breed, and claw status for each of 3 Cats Cat myCat2 = new Cat(); myCat2.setName(name); myCat2.setBreed(breed); myCat2.setAge(age); myCat2.setWeight(weight); myCat2.setDeclawed(is_declawed); System.out.println("The Cats over 3 years old with claws are: "); if(myCat2.getAge() >= 3 && myCat2.getIs_declawed()== false) System.out.println("Name: " + myCat2.getName()); System.out.println("Age: " + myCat2.getAge() + "Years Old:"); System.out.println("Enter cats name:"); name = input.next(); //Input Cats age System.out.println("Enter cats age :"); age = input.nextInt(); //Input Cats weight System.out.println("Enter cats weight :"); weight = input.nextDouble(); //Input Cats breed System.out.println("Enter cats breed :"); breed = input.next(); //Input value true or false for Cats claw status System.out.println("Is your cat declawed? (True or False) :"); is_declawed = input.nextBoolean(); //method used to set variables name, age, weight, breed, and claw status for each of 3 Cats Cat myCat3 = new Cat(); myCat3.setName(name); myCat3.setBreed(breed); myCat3.setAge(age); myCat3.setWeight(weight); myCat3.setDeclawed(is_declawed); //provides desired output System.out.println("The Cats over 3 years old with claws are: "); if(myCat3.getAge() >= 3 && myCat3.getIs_declawed()== false) System.out.println("Name: " + myCat3.getName()); System.out.println("Age: " + myCat3.getAge() + "Years Old:"); } } 

Reference no: EM13847810

Questions Cloud

Bonds make semiannual payments : Heginbotham Corp. issued 20-year bonds two years ago at a coupon rate of 8.9 percent. The bonds make semiannual payments. If these bonds currently sell for 110 percent of par value, what is the YTM?
Annual dividend-required rate of return : Last week, Railway Cabooses paid its annual dividend of $1.20 per share. The company has been reducing the dividends by 10% each year. How much are you willing to pay to purchase stock in this company if your required rate of return is 14%?
Write a program in Java to check if a number is even : Write a program in Java to check if a number is even or odd in Java?
What is maximum price per share schultz should pay for arras : Schultz Industries is considering the purchase of Arras Manufacturing. Arras is currently a supplier for Schultz, and the acquisition would allow Schultz to better control its material supply. The current cash flow from assets for Arras is $7.4 milli..
The new class has the attributes of: name - type string age : Here is my current assignment I got the cat file to work I'm just having trouble with the driver file. You must create two Java files called LastNameFirstNameUnit6Prog.java, and Cat.java. Ensure you include ALL files required to make your program com..
Briefly explain the code in sort inventory : Draw a UML diagram of the Shoe class using the code that has been provided - Briefly explain the code in sort Inventory. What is the inventory being sorted by? What is the sort algorithm that is being used. Explain in words how it works. Why do you..
First withdrawal in order to meet his retirement goal : Harry plans to start saving to provide for his retirement. Beginning one month from now, he will begin depositing a fixed amount each month into a retirement savings account that will earn 8.4% APR, compounded monthly. How much must Harry deposit int..
Fixed-rate : You are applying for a 30-year, fixed-rate (APR 6.50%), monthly-payment-required mortgage loan for a house that sells for $80,000 today. The mortgage bank will ask you for 20% initial down payment (in cash, paid immediately) of the house value
What reasons might exist for initiating an evaluation : What reasons might exist for initiating an evaluation? When might an evaluation be inappropriate? What steps or activities are involved in planning how to conduct an evaluation

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a java class

Write a Java class called PQueue that extends the provided abstract QueueADT class.

  Calculate the percentage wins of a team

Write a program that will calculate the percentage wins of a team. The program will input the number of wins and losses that a team acquired during a season. The wins should be input in a parameter-less value returning function that returns the wi..

  Make a fourth button called special

Make a fourth button called "special" that does something else notdescribed in the assignment, such as change the background color.

  Problem related to eclips

Goals: 1) Be able to work with individual bits in java. 2) Understand the serializable interface. 3) Understand the comparable interface.

  Write a program that prompts the user to enter an integer

Using && and || write a program that prompts the user to enter an integer and determine whether it is: Evenly divisible by 5 AND 6.

  Create a new project in ide named exceptionhandler

Write code to accept numbers as described above from the user. Your code should ensure that only numbers are accepted.

  Java shape program console

Program is adequately documented. It's comments identifies its name, purpose, author and date.Throughout the code, comments and/or relevant component names should attempt to make theprogram understandable.

  Integers as a parameter and returns the number

Write a method maxOccurrences that accepts a list of integers as a parameter and returns the number the number of times the most frequently occurring integer

  Temporarily move to the street so that the

Driveway is a "last-in, first-out" stack. Of course, when a car owner retrieves a vehicle that wasn't the last one in, the cars blocking it must temporarily move to the street so that the requested vehicle can leave

  Write a graphical user interface class

Write a graphical user interface class called SentenceCounterGUI. It should be able to manipulate the sentence of words and have the behaviour label.

  Design a java class to represent a 3-d geomtetric shape

Design and implement a Java class to represent a 3-D geomtetric shape of your choice. The class should contain a constructor, appropriate data fields and methods to return the volume of the shape, and the surface area of the shape and any other me..

  Requests 2 numbers from the user and then passes

Write a program in java that requests 2 numbers from the user and then passes these 2 numbers to a method findMax that displays the largest number. Make sure your method is called fron main(). Test the method by passing various data to it

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