Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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:"); } } 

Java, Programming

  • Category:- Java
  • Reference No.:- M91417596
  • Price:- $20

Guranteed 24 Hours Delivery, In Price:- $20

Have any Question?


Related Questions in Java

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As