码迷,mamicode.com
首页 > 其他好文 > 详细

95-712 Practice problem

时间:2019-10-18 18:59:00      阅读:67      评论:0      收藏:0      [点我收藏+]

标签:VID   help   lin   variable   ESS   access   follow   ima   ice   


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, Dog, 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, 3, 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 或邮箱:99515681@qq.com 

微信:codehelp

95-712 Practice problem

标签:VID   help   lin   variable   ESS   access   follow   ima   ice   

原文地址:https://www.cnblogs.com/weljavat/p/11700020.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!