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, 22.06.2019 09:00
Which best describes the condition under which the unicode output is the same as plain text?
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
Which of the following is not a symptom of chronic fatigue syndrome
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
Social Studies, 10.01.2020 09:31
question
Mathematics, 10.01.2020 09:31
question
Health, 10.01.2020 09:31
question
Health, 10.01.2020 09:31
Questions on the website: 13722367