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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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