Question: public class GreenvilleMotto { public static void main ( String [ ] args ) { / / Define the motto String motto = The stars

public class GreenvilleMotto {
public static void main(String[] args){
// Define the motto
String motto = "The stars shine in Greenville.";
// Determine the length of the border (including spaces)
int borderLength = motto.length()+4; //2 asterisks on each side
// Display the top border
for (int i =0; i < borderLength; i++){
System.out.print("*");
}
System.out.println(); // Move to the next line
// Display the motto with borders
System.out.println("*"+ motto +"*");
// Display the bottom border
for (int i =0; i < borderLength; i++){
System.out.print("*");
}
System.out.println(); // Move to the next line
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!