subject

Class TShirt{ private String colour;
private int size;

public TShirt(String s, int n){
colour = s;
/* to be implemented in part (a)*/
}

public String getColour(){
return colour;
}

public int getSize(){
return size;
}

/
* if the shirt has a positive size, reduce the
* size by 1. If the size is 0, no change.
/
public void shrinkShirt(){
/* to be implemented in part */
}
}

Write a line of code that declares a new variable named ledZeppelin of type TShirt and initializes it to refer to a new TShirt with colour "black" and size 5.

Finish implementing the method shrinkShirt().

Suppose s1 and s2 are properly initialized variables of type TShirt. Write a code segment that prints "Identical" if the shirts are the same colour and the same size, "Uniform" if they are the same colour but not the same size, "Fits" if they are the same size but not the same colour, and "Different" if they are different sizes and different colours.

if(colour == size ){

}

Suppose s1 and s2 are properly initialized variables of type TShirt. Write a code segment that, if the shirts are the same colour and their sizes differ by exactly one, it shrinks the larger shirt by one size.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:10
The total cost of textbooks for the term was collected from 36 students. create a histogram for this data. $140 $160 $160 $165 $180 $220 $235 $240 $250 $260 $280 $285 $285 $285 $290 $300 $300 $305 $310 $310 $315 $315 $320 $320 $330 $340 $345 $350 $355 $360 $360 $380 $395 $420 $460 $460
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
question
Computers and Technology, 23.06.2019 10:00
What is estimated time of arrival (eta)? a device that measures the acceleration (the rate of change of velocity) of an item and is used to track truck speeds or taxi cab speeds a gps technology adventure game that posts the longitude and latitude location for an item on the internet for users to find a north/south measurement of position the time of day of an expected arrival at a certain destination and is typically used for navigation applications
Answers: 3
question
Computers and Technology, 23.06.2019 11:30
Which excel file extension stores automated steps for repetitive tasks?
Answers: 1
You know the right answer?
Class TShirt{ private String colour;
private int size;

public TShirt(String s, in...
Questions
question
Mathematics, 21.08.2019 21:40
question
Mathematics, 21.08.2019 21:40