95-712 Practice problem

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

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

微信:codehelp

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

时间: 2024-07-31 23:43:47

95-712 Practice problem的相关文章

http://47.95.147.191/problem/P3

http://47.95.147.191/problem/P3规定边数的最短路,跑floyd+矩阵快速幂 #include<iostream> #include<cstdio> #include<queue> #include<algorithm> #include<cmath> #include<ctime> #include<set> #include<map> #include<stack>

[email&#160;protected] Sieve of Eratosthenes (素数筛选算法) &amp; Related Problem (Return two prime numbers )

Sieve of Eratosthenes (素数筛选算法) Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number. For example, if n is 10, the output should be “2, 3, 5, 7″. If n is 20, the output should be “2, 3, 5, 7, 11, 13,

《CS:APP》 chapter 2 Representing and Manipulating Information 笔记

Representing and Manipulating Information 首先,普及一下历史知识,原来十进制数都使用1000多年了...其实我真不知道...斐波拉契(Fibonacci)很屌的说(废话....) The familiar decimal, or base-10, representation has been in use for over 1000 years, having been developed in India, improved by Arab math

证明tmult_ok的正确性

csapp page124. practice problem 2.35 /* Determine whether arguments can be multiplied without overflow */ int tmult_ok(int x, int y){ int p = x*y; /* Either x is zero, or dividing p by x gives y */ return !x || p/x == y; } 函数 tmult_ok 的功能是检查两个二补数相乘会不

加州大学伯克利分校Stat2.2x Probability 概率初步学习笔记: Section 4 The Central Limit Theorem

Stat2.2x Probability(概率)课程由加州大学伯克利分校(University of California, Berkeley)于2014年在edX平台讲授. PDF笔记下载(Academia.edu) Summary Standard Error The standard error of a random variable $X$ is defined by $$SE(X)=\sqrt{E((X-E(X))^2)}$$ $SE$ measures the rough size

Total Commander 8.52 Beta 1

Total Commander 8.52 Beta 1http://www.ghisler.com/852_b1.php 10.08.15 Release Total Commander 8.52 beta 1 (32/64) 05.08.15 Fixed: Windows 10: Loading drive buttonbar hanging on some devices (e.g. Surface Pro 3) when SD-Card was in internal card reade

The Essential Skills to Becoming a Master Hacker

2 Networking Skills You need to understand the basics of networking, such as the following. DHCP NAT Subnetting IPv4 IPv6 Public v Private IP DNS Routers and switches VLANs OSI model MAC addressing ARP As we are often exploiting these technologies, t

加州大学伯克利分校Stat2.2x Probability 概率初步学习笔记: Section 3 The law of averages, and expected values

Stat2.2x Probability(概率)课程由加州大学伯克利分校(University of California, Berkeley)于2014年在edX平台讲授. PDF笔记下载(Academia.edu) Summary Law of Large Numbers As the number of trials increases, the chance that the proportion of successes is in the range $$p\pm\text{a fi

C. Sad powers

You're given Q queries of the form (L, R). For each query you have to find the number of such x that L ≤ x ≤ R and there exist integer numbers a > 0, p > 1 such that x = ap. Input The first line contains the number of queries Q (1 ≤ Q ≤ 105). The ne