Java application

Overview

Nearly every Java application involves multiple classes. For this assignment, you will work on a Dog application composed of three classes. The Dog and Corgi classes have been started for you; you will complete these classes and create the Driver class from scratch. The application will be used to collect and print details about specific dogs. As you can see from the UML class diagram on this page, the Corgi class (child/subclass) inherits from the Dog class (parent/superclass). In the Corgi class file definition, the “extends” keyword is used to establish that it inherits from the Dog class.

Prompt

For this assignment, you will complete the Dog application by completing the Dog and Corgi classes and creating the Driver class. Use the Uploading Files to Eclipse and the Downloading Files From Eclipse tutorials to help you with this project.

  1. Open the Virtual Lab by clicking on the link in the Virtual Lab Access module. Then open your IDE and upload the DogApp.zip folder containing the Dog and Corgi class files. You will be creating a Driver class in the same project folder. When you upload the files, you will see errors due to the classes being incomplete. As you complete each class, any errors should resolve.

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now
  1. Complete the Dog class:
    1. Using the UML Class diagram to the right, declare the class variables. A text version is available: UML Class Diagram Text Version.
    2. Create a constructor that incorporates the type, breed, and name variables (do not include topTrick).
      Note: The type refers to what the breed typically does; for example, a corgi would be a “cattle herding dog.” A Shiba Inu would be a “hunting dog.”
    3. Create the setTopTrick() mutator method.
  2. Complete the Corgi class:
    1. Using the UML Class diagram, declare the class variables.
    2. Create the two mutator methods for the class variables.
  3. Make sure to select the Project folder, then add a new class. Name it the Driver class, then create the code:
    1. There should be no class variables.
    2. The main() method will be the only method in the class.
    3. Write three lines of code in the main() method:
      1. Instantiate a corgi object using the below syntax:
        className objectName = new className(input parameters)TIP: Refer to the constructors in the Dog and Corgi classes to ensure the input parameters are correct.
      2. Use the objectName.setTopTrick() method to set a top trick for the dog you created.
      3. Embed the objectName.toString() method in a statement that outputs to the console window.
  4. Once you have completed the code for the Dog and Corgi classes and created a Driver class, right-click the Project folder and select Run As, then Java Application. You should see output in the Console window that resembles the sample below. Your results will vary based on your input values.

Sample Output

DOG DATA
Java is a Pembroke Welsh Corgi, a cattle herding dog.
The top trick is: ringing the bell to go outside.

Module Four Assignment Guidelines and Rubric.html

Overview

Nearly every Java application involves multiple classes. For this assignment, you will work on a Dog application composed of three classes. The Dog and Corgi classes have been started for you; you will complete these classes and create the Driver class from scratch. The application will be used to collect and print details about specific dogs. As you can see from the UML class diagram on this page, the Corgi class (child/subclass) inherits from the Dog class (parent/superclass). In the Corgi class file definition, the “extends” keyword is used to establish that it inherits from the Dog class.

Prompt

For this assignment, you will complete the Dog application by completing the Dog and Corgi classes and creating the Driver class. Use the Uploading Files to Eclipse and the Downloading Files From Eclipse tutorials to help you with this project.

  1. Open the Virtual Lab by clicking on the link in the Virtual Lab Access module. Then open your IDE and upload the DogApp.zip folder containing the Dog and Corgi class files. You will be creating a Driver class in the same project folder. When you upload the files, you will see errors due to the classes being incomplete. As you complete each class, any errors should resolve.

  1. Complete the Dog class:
    1. Using the UML Class diagram to the right, declare the class variables. A text version is available: UML Class Diagram Text Version.
    2. Create a constructor that incorporates the type, breed, and name variables (do not include topTrick). Note: The type refers to what the breed typically does; for example, a corgi would be a “cattle herding dog.” A Shiba Inu would be a “hunting dog.”
    3. Create the setTopTrick() mutator method.
  1. Complete the Corgi class:
    1. Using the UML Class diagram, declare the class variables.
    2. Create the two mutator methods for the class variables.
  1. Make sure to select the Project folder, then add a new class. Name it the Driver class, then create the code:
    1. There should be no class variables.
    2. The main() method will be the only method in the class.
    3. Write three lines of code in the main() method:
      1. Instantiate a corgi object using the below syntax:
        className objectName = new className(input parameters)

        TIP: Refer to the constructors in the Dog and Corgi classes to ensure the input parameters are correct.

      2. Use the objectName.setTopTrick() method to set a top trick for the dog you created.
      3. Embed the objectName.toString() method in a statement that outputs to the console window.
  1. Once you have completed the code for the Dog and Corgi classes and created a Driver class, right-click the Project folder and select Run As, then Java Application. You should see output in the Console window that resembles the sample below. Your results will vary based on your input values.

Sample Output

DOG DATA Java is a Pembroke Welsh Corgi, a cattle herding dog. The top trick is: ringing the bell to go outside. The Corgi is 5 years old and weighs 38 pounds.

Guidelines for Submission

Attach your completed Dog.java, Corgi.java, and Driver.java files to the assignment submission page.

Module Four Assignment Rubric

Criteria Exemplary (100%) Proficient (85%) Needs Improvement (55%) Not Evident (0%) Value
Dog Class Modifies a class so that it includes all class variables, a constructor method incorporating the prescribed variables, and a mutator method Meets most “Proficient” criteria, but with minor errors; areas for improvement may include appropriate data structures or naming conventions Meets some “Proficient” criteria, but with major errors or exclusions; areas for improvement may include functionality, syntax, or logic Does not attempt criterion 35
Corgi Class Modifies a class so that it includes all class variables and mutator methods for all class variables Meets most “Proficient” criteria, but with minor errors; areas for improvement may include appropriate data structures or naming conventions Meets some “Proficient” criteria, but with major errors or exclusions; areas for improvement may include functionality, syntax, or logic Does not attempt criterion 25
Driver Class Creates a class that includes a main() method, instantiates an object, calls a method from another class, and prints output Meets most “Proficient” criteria, but with minor errors; areas for improvement may include syntax error, improper constructor, or outputting the wrong data Meets some “Proficient” criteria, but with major errors or exclusions; areas for improvement may include functionality, syntax, or logic Does not attempt criterion 40
Total: 100%

course_documents/Uploading Files to Eclipse Tutorial.pdf

 

 

Uploading Files to Eclipse This tutorial will guide you through the process of uploading a project into Eclipse via the STEM Lab.

1. Open the STEM Lab and select the Launch button for the Java Programming app. The virtual environment can take a couple of minutes to load.

 

2. Once the STEM Lab opens, be sure your browser window is in full-screen mode. Select the

upload icon on the STEM Lab tool bar.

 

3. In the File upload window, select a destination folder by clicking the Upload button. This is where the file will appear when you upload it. For this example, we will select Desktop.

 

4. Next, you are provided with a File Upload dialog box. Navigate to and select the file you want to

upload. Then, click the Open button. In this example, we’ve selected the studentproject.zip file.

 

 

 

 

 

5. Once the file uploads, it will be listed in the File Upload window and in the destination folder you selected. In this example, the studentproject.zip file appears in the File upload window, and the destination folder is the Desktop.

 

 

6. Close the File upload dialog window.

 

 

 

7. Locate the studentproject.zip folder. In this case, it is saved on the Desktop. Right-click on the folder and select Extract All…

 

 

8. This will bring up a dialog box asking you to select a destination for your extracted files. In this example, the default location is the Desktop. Click Extract, which will create an unzipped folder in the destination you have selected.

 

 

 

 

 

9. Next, open Eclipse by double-clicking the Eclipse icon located on the Desktop.

 

10. Select the Launch button in the Eclipse Launcher window to open Eclipse.

 

11. From the File menu, select Open Projects from File System. This will open up a dialog window.

 

 

 

 

12. You will use the Import dialog window to navigate to the project you uploaded. Next to the Import Source text box, click the Directory… button to browse for your project folder.

 

 

13. In the dialog box, navigate to the destination folder where you uploaded your project. In this example, the destination folder is the Desktop. Select your project folder and click the OK button.

 

 

 

 

 

14. After selecting the file to import, you should see the folder’s address in the Import Source textbox. Select the Finish button in the Import dialog window.

 

 

 

 

15. To access the project files, navigate to the Package Explorer workspace. You can view and open your project files in this workspace.

a) In the Package Explorer workspace, click on the arrow next to the project folder to view the

files. In this example, the folder is called studentproject. b) To open your files in the Package Explorer workspace and begin working, double-click on

each class file. Each file will have its own tab, so you can easily switch back and forth between them. Your project is now in Eclipse and ready for you to use!

 

 

 

course_documents/DogApp.zip

Dog.java

Dog.java

public   class   Dog   {

// class variables

// constructor

// methods

// method used to print Dog information
public   String  toString ()   {
String  temp  =   "\nDOG DATA\n"   +  name  +   " is a "   +  breed  +
", a "   +  type  +   " dog. \nThe top trick is : "   +
topTrick  +   "." ;
return  temp ;
}

}

Corgi.java

Corgi.java

public   class   Corgi   extends   Dog   {

// additional class variables

// constructor
public   Corgi ( String  type ,   String  breed ,   String  name ,   int  pounds ,   int  years )   {

// invoke Dog class (super class) constructor
super ( type ,  breed ,  name );
weight  =  pounds ;
age  =  years ;
}

// mutator methods

// override toString() method to include additional dog information
@ Override
public   String  toString ()   {
return   ( super . toString ()   +   "\nThe Corgi is "   +  age  +
" years old and weighs "   +  weight  +   " pounds." );
}

}

course_documents/Module Four UML Class Diagram.png

course_documents/IT 145 Module Four UML Class Diagram Text Version.docx

Dog
type: string breed: string name: string

topTrick: string

setTopTrick(trick:string) toString()

 

 

Corgi
weight:int age:int
setWeight(pounds:int) setAge(years:int) toString()

 

 

Arrow pointing from table labeled Corgi to table labeled Dog