milijar.blogg.se

Greenfoot showtext
Greenfoot showtext






greenfoot showtext

Write the ClassRoster method studentwithmaxgpa()that returns the last name of the student in the studentlist who has the max GPA. Write a one-argument constructor to initialize the name of the class AND create and populate the ArrayList studentlist with at least 5 students. Include an ArrayList instance variable called studentlist that can store objects of type Student. Include a String instance variable coursename that will store the name of the class, e.g., AP Computer Science, Shakespeare, AP World History, etc. Here are the specs for the ClassRoster class: 1. You will be sent a template for this project. ClassRoster will store the name of the class as well as all Students registered for the class. (BlueJ) Write a program that creates a class called ClassRoster that will model a teacher s class roster. Are all schools with a name of length 4 removed? ģ P4D. Add UMass, Army, and Navy to the end of collegelist and run your program again. Schools with names that consist of 4 letters should not appear in the printout. Write a third for loop to print the names of colleges in collegelist again. Write a second for loop to remove each school whose name has four letters.

greenfoot showtext

Write a for loop to print the names of the colleges in collegelist. Populate collegelist with the names of at least 5 colleges that you are applying to. Create an ArrayList called collegelist that can hold objects of type String. Complete the following items below to help you filter your college choices: a. In this program, we ll write a program to model your college choices along with an algorithm that will help narrow down your choices according to a complex statistical analysis. Modify the deleteallsongs() method so that the length of the ArrayList songlibrary is 0 after all the songs have been removed.

greenfoot showtext

Modify the totalplaytime() method so that the method works correctly with the ArrayList songlibrary. Modify the two-argument constructor to create and populate the ArrayList songlibrary. Complete the following to complete the upgrade: a.

GREENFOOT SHOWTEXT UPGRADE

(BlueJ) Upgrade the MyPhone to a MyPhone2 to use an ArrayList instead of an array. print the information for your phone a second time to verify that all songs have been deleted. 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.

greenfoot showtext

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. 1 AP Computer Science Homework Set 4 Class Composition P4A.








Greenfoot showtext