Pārlūkot izejas kodu

converted to BlueJ

L. Dolio Durant 6 gadus atpakaļ
revīzija
74c39b11d8
5 mainītis faili ar 99 papildinājumiem un 0 dzēšanām
  1. 23
    0
      .gitignore
  2. 5
    0
      MainApplication.java
  3. 6
    0
      MainApplicationTest.java
  4. 40
    0
      README.md
  5. 25
    0
      package.bluej

+ 23
- 0
.gitignore Parādīt failu

@@ -0,0 +1,23 @@
1
+# ---> Java
2
+# Compiled class file
3
+*.class
4
+
5
+# Log file
6
+*.log
7
+
8
+# BlueJ files
9
+*.ctxt
10
+
11
+# Mobile Tools for Java (J2ME)
12
+.mtj.tmp/
13
+
14
+# Package Files #
15
+*.jar
16
+*.war
17
+*.ear
18
+*.zip
19
+*.tar.gz
20
+*.rar
21
+
22
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23
+hs_err_pid*

+ 5
- 0
MainApplication.java Parādīt failu

@@ -0,0 +1,5 @@
1
+/**
2
+ * Created by leon on 11/6/17.
3
+ */
4
+public class MainApplication {
5
+}

+ 6
- 0
MainApplicationTest.java Parādīt failu

@@ -0,0 +1,6 @@
1
+
2
+/**
3
+ * Created by leon on 11/6/17.
4
+ */
5
+public class MainApplicationTest {
6
+}

+ 40
- 0
README.md Parādīt failu

@@ -0,0 +1,40 @@
1
+# Polymorphism Lab 1
2
+
3
+## Objectives
4
+
5
+1. Students will practice basic polymorphic program design in this lab.
6
+2. After completing this lab students should be familiar with running tests against their code to confirm it is functioning properly.
7
+
8
+
9
+## Overview
10
+
11
+In this lab you will practice creating a simple Java program designed to make use of polymorphic design.
12
+
13
+## Unit Test
14
+
15
+Select a partner from your tribe; You will each write tests for the requirements below, but your partner must develop against your tests and vice versa. Be sure to use the `io.zipcoder.pets` package for your Pet classes to allow tests to execute properly.
16
+
17
+**Hint:** *An easy way to achieve this is for each partner to set up a GitHub repository for this lab, and add the other partner as a collaborator with write access (in the repository settings).*
18
+
19
+## Instructions
20
+
21
+### Part 1:
22
+
23
+Create a program that asks the user how many pets they have. Once you know how many pets they have, ask them what kind of pet each one is, along with each pet's name. For now your program should just hold onto the user input and print out the list at the end; we'll modify this in part 3.
24
+
25
+### Part 2:
26
+
27
+Create a Pet class, and a subclass for each type of pet that you want your program to support. Your classes should follow the following requirements:
28
+
29
+- You must support at least three types of pets.
30
+- Dog must be one of the types you support.
31
+- Cat must be one of the types you support.
32
+- The Pet class must have a `speak` method that each subclass overrides.
33
+- The Pet class must have a `name` field with setters and getters.
34
+
35
+Use the tests provided as examples to write your own tests for other supported types of pets.
36
+
37
+### Part 3:
38
+
39
+Modify your program from part 1 to use the Pet class and its subclasses. Keep a list of the pets your user lists and at the end of the program print out a list of their names and what they say when they speak.
40
+

+ 25
- 0
package.bluej Parādīt failu

@@ -0,0 +1,25 @@
1
+#BlueJ package file
2
+editor.fx.0.height=722
3
+editor.fx.0.width=800
4
+editor.fx.0.x=560
5
+editor.fx.0.y=117
6
+objectbench.height=101
7
+objectbench.width=461
8
+package.divider.horizontal=0.6
9
+package.divider.vertical=0.8007380073800738
10
+package.editor.height=427
11
+package.editor.width=674
12
+package.editor.x=141
13
+package.editor.y=59
14
+package.frame.height=600
15
+package.frame.width=800
16
+package.numDependencies=0
17
+package.numTargets=0
18
+package.showExtends=true
19
+package.showUses=true
20
+project.charset=UTF-8
21
+readme.height=58
22
+readme.name=@README
23
+readme.width=47
24
+readme.x=10
25
+readme.y=10