5/7/2023 0 Comments Greenfoot showtext![]() call the deleteallsong() method for your phone, vi. print the result of the MyPhone method totalplaytime(). print the information for your MyPhone object using the tostring() method of the MyPhone class, iv. ![]() The songlibrary will be populated in the multiargument constructor. initialize its instance variables using its multi-argument constructor. create a MyPhone object called phone, ii. Ģ Write a MyPhoneDriver to perform the following: i. a tostring() method to display the object s three instance variables (including songlibary) in a user-friendly format. a brain method called deleteallsongs() that will remove all songs from memory by placing null into each element in the array. a brain method called totalplaytime() that will return an integer for the total number of seconds for all songs stored in the songlibrary. You can populate the songlibrary in the constructor with four songs of your choice in the two-argument constructor. a two-argument constructor to initialize the instance variables color and memorycapacity. an instance variable of type array that can hold 4 Song objects called songlibrary that will store the songs in the MyPhone, d. an instance variable for its memory capacity (in GB), c. Class MyPhone should include the following: a. Using one object as a container (the MyPhone class) to store another type of object (the array of Songs) is called class composition or the building of an object using other objects as its components. This can be done by copying the Song.java file from your P3AProject folder into your P4AProject folder. You can use your Song class from P3A in this project. We ll do this by adding an instance variable that is an array of type Song to your MyPhone class. Your MyPhone will include some information about the phone as well as your music library. (BlueJ) In this program we will write a MyPhone class to represent your company s new smart phone. USER INSTRUCTIONS: See the description above.1 AP Computer Science Homework Set 4 Class Composition P4A. HOW TO START THIS PROJECT: Click the Run button InĪddition, both targets return to their default displays and a "bong" sound effect is played. When the mouse retreats to the world background, the menu items disappear and the menu header returns to black. When the user clicks a green menu item, the corresponding target display changes to match the text in the menu item. Online version so I disabled them in the online version.) (Note: The sound effects seemed to adversely impact the performance of the To green, a "ding" sound effect is played. Each time a menu item (not including the header) switches from black Turns black and the second one turns to green. When the user touches another black menu item, the first one When the user touches a black menu item, it turns green. In addition, a small image of a bee, aīutterfly, or a frog appears on each end of the text in each menu item in the Right Menu. The style of each menu item in the Right Menu matches the text description. The styles of the menu items in the Left Menu are all plain. When the user touches a black menu header with the mouse, it turns green and exposes a set of black menu items below the header. The menu items in the Right Menu can be used toĬause the right target to switch among PLAIN, ITALIC, BOLD, and BOLD-ITALIC styles surrounded by small frogs, Target to switch among an image of a frog, a butterfly, or a bee. The menu items in the Left Menu can be used to cause the left In PLAIN style surrounded by images of small frogs. The default target object on the right contains the word Right Target The default screen display consists of two black menu headers and two target objects. If and when the article is published, you will find a link to the article at I am publishing this scenario in support of an article that I plan to publish on the topic of custom GUIs using To illustrate how to use the Menu class to create and service custom GUI menus. To deliver the source code for a working GUI class named Menu that can be used by objects of other classes to placeĪny number of custom GUI menus in a Greenfoot world.ī. The earlier scenario was designed mainly to provide proof of concept. (Apparently I inadvertently deleted the earlier version while publishing this version but that doesn't matter since this is a replacement.) ![]() This is a major upgrade of the scenario named Menu01, which I published earlier at
0 Comments
Leave a Reply. |