加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

95-712 Practice problem

发布时间:2020-12-15 07:21:59 所属栏目:Java 来源:网络整理
导读:95-712 Practice problem 8 This problem brings together what you learned in inheritance, polymorphism,access specifiers,and JavaFX Problem statement: The GUI for this app is provided to you (Fig.1). It currently supports three pets: Cat,Dog


95-712 Practice problem 8
This problem brings together what you learned in inheritance,
polymorphism,access specifiers,and JavaFX
Problem statement: The GUI for this app is provided to you
(Fig.1). It currently supports three pets: Cat,Dog,and Bird.
User clicks on the any one of the three pet buttons,and the
app displays the sound made by that pet. It also displays a
count of number of times the user clicks on each pet. (Fig.2,3,4). You
need to create the Pet classes and write event-handlers to complete the app.
Figure 2: User clicked Cat once Figure 3: Then user clicked Dog once Figure 4: Then user clicked Dog again,and then Bird
Solution Design: The UML in Figure 5 shows classes,their methods and variables. The app is launched from PickAPet.java.
Its GUI has three buttons as shown in Fig.1. You need to do the following

95-712留学生作业代做、代写Java编程设计作业
1. Create an abstract Pet class with abstract talk() method,and a variable petCount to count all pets selected by user.
2. Create Cat,and Bird classes that extend Pet and implement talk() that returns a string “Meow…”,“Bark…”,and
“Tweet…” respectively. They also have their own count variables to count the number of times they are chosen.
3. Create three handlers as member classes in PickAPet.java to update countLabels and resultLabel as shown in Figure
2,4. Bind them to the three buttons in setupScreen() method - buttons[0],buttons[1],and buttons[2].
4. Finally,run the test-cases to check correct execution of your program.
Figure 5: Solution Design
Note: The pet objects are already created for you and stored in pets array in PickAPet.java. You should not be creating
any new pet objects.
main(args: String[]): void
resultLabel: Label
countLabels: Lable[]
start(primaryStage: Stage): void
setupScreen(): void
<<Interface>>
ActionEvent
EventHandler
handle(event:ActionEvent): void
Application
start(primaryStage: Stage): void
Figure 1: GUI components in opening screen

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:[email?protected]?

微信:codehelp

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读