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

  Calculate state income tax for a single taxpayer

The second programming project involves writing a program to calculate state income tax for a single taxpayer that uses a GUI

  The frantic pipe layer game1 the completed gamehere is what

the frantic pipe layer game.1 the completed gamehere is what the user interface should look like when completedyou must

  Write specifications for method which advances date by one

Write specifications for the method which advances any given date by one day. Comprise a statement of purpose, pre- and post-conditions, and description of parameters.

  Java application prompt user to put in integer from keyboard

Write a java application that performs the following task: prompt user to put in an integer from the keyboard, search for the user input from the array created in step 1.

  Prevent clear communication

Conversational implicature always prevents clear communication - Describe a situation where communication between you and a co-worker

  Write a program to store in a 2-d boolean array

Write a program to store in a 2-D boolean array of size 5 and 10 a true value if a random value is less than 0.5 else false. Print only the indexes of cells with true value.

  Write an applet that includes a pie chart

Write an applet that includes a pie chart. Use a news article with statistics that are good candidates for a pie chart: for example, political candidate preferences; percentages of those for, against, or undecided about a ballot measure; and so for..

  Difference between sequential access and random access

What is the difference between sequential access and random access? What are BufferedInput/OutputStreams and why are they used? Write some Java code to illustrate how to create a BufferedInputStream

  Write function in javascript to compute person-s gross pay

Write the function using JavaScript syntax to compute a person's gross pay for a week. The function should receive the number of hours worked and the rate of pay per hour.

  Which drags html list items to and from a javascript array

Write a program which drags html list items to and from a javascript array.

  Use java

How to use Java.

  Design and construct a computer program

Design and construct a computer program in one of the approved languages (C, C++, Java, Pascal, etc.) that will illustrate the use of a third-order explicit Runge-Kutta method of your own design.

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