subject

The following class contains code to define a nintendo character where characters have a name and a primary outfit color. the main method creates 3 instances of this, each different characters in the game update the main method to add these three characters to a collection (of any type), then iterate through the collection and print each character. next, sort the collection and print each character again

public class nintendocharacter implements comparable {

private color color;
private string name;

public nintendocharacter { color outfitcolor, string charactername } {
this. color = outfitcolor;
this. name = charactername;

@override
public int compareto (object o) {
return color. ( ((nintendocharacter)o).color, to. string() );
}

public string tostring () {
return name + " : " + color. tostring ();
}

public static void main (string[] args) {
nintendocharacter m = new nintendocharacter (color. red, ? mario");
nintendocharacter l = new nintendocharacter (color. gree, "luigi");
nintendocharacter p = new nintendocharacter (color. magenta, "princess peach");

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:00
In a file-oriented information system, a work file stores relatively permanent data about an entity is created and saved for backup and recovery purposes stores records that contain day-to-day business and operational data is a temporary file created by an information system for a single task
Answers: 1
question
Computers and Technology, 22.06.2019 10:00
Which of the following is true of operations within a spreadsheet program’s built-in functions? a. operations within parentheses, then multiplication and division, and then addition and subtraction are computed. b. operations within parentheses, then addition and subtraction, and then multiplication and division are computed. c. multiplication and division, then addition and subtraction, and then operations within parentheses are computed. d. addition and subtraction, then multiplication and division, and then operations within parentheses are computed
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
What is the term for water wave that is created by an underwater earthquake
Answers: 1
question
Computers and Technology, 24.06.2019 10:30
You're programming an infinite loop. what must you include in your code to prevent crashes? in roblox
Answers: 2
You know the right answer?
The following class contains code to define a nintendo character where characters have a name and a...
Questions
question
Mathematics, 15.04.2021 08:20
question
Mathematics, 15.04.2021 08:20
Questions on the website: 13722362