Write a class named PingPong that has a method next that alternates between printing 'PING' and 'PONG' as shown below. >>> ball - PingPong () >>> ball.next() PING >>> ball.next() PONG >>> ball.next() PING >>> ball.next() PONG

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 6RQ
icon
Related questions
Question

in python please

Write a class named PingPong that has a method next that alternates
between printing 'PING' and 'PONG' as shown below.
>>> ball- PingPong ()
>>> ball.next()
PING
>>> ball.next()
PONG
>>> ball.next()
PING
>>> ball.next()
PONG
Transcribed Image Text:Write a class named PingPong that has a method next that alternates between printing 'PING' and 'PONG' as shown below. >>> ball- PingPong () >>> ball.next() PING >>> ball.next() PONG >>> ball.next() PING >>> ball.next() PONG
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,