Question: Advanced Java Programming with Object-Oriented Programming Design VERY IMPORTANT NOTE!!: This program for the question below MUST USE at least 2 CLASSES, getters/setters, etc and

Advanced Java Programming with Object-Oriented Programming Design

VERY IMPORTANT NOTE!!: This program for the question below MUST USE at least 2 CLASSES, getters/setters, etc and other object-oriented design (OOD) concepts because I'm in a more advanced Java class that requires me to utilize the concepts mentioned above. Also, I need detailed, but brief comments to most, if not all of the code to explain what is being used in the code and what is does so I have a better understanding of the code. I've seen answers to the question below already posted, however they don't utilize object-oriented design (OOD) concepts such as a minumum of two classes, getters/setters, etc which is required for this advanced Java programming class. So please......answer the question and meet the requirements for this question. Basically, I need advanced Java object-oriented design concepts for simple programs so here's to hoping this works out and if it does, I'll give a thumbs up, I promise!!!

Modify the method created in Exercise 6.18 to receive a second parameter of type char called fillCharacter. Form the square using the char provided as an argument. Thus, if side is 5 and fillCharacter is # , the method should display

#####

#####

#####

#####

#####

Use the following statement (in which input is a Scanner object) to read a character from the user at the keyboard:

char fill = input.next().charAt( 0 );

Here's what I got to modify:

import java.util.Scanner; public class Asterisks { //Declarations private int side; //Getter public int getSide() {

return side;

} //Setter public void setSide(int side) {

this.side = side;

}

public Asterisks (int side) {

this.side = side;

} //Show the square public void displaySquare() {

for(int m=0;m

System.out.println();

for(int k=0;k

System.out.print("*");

} } } }

class AsterisksMain { //Class with a main which will allow you to run this program. public static void main(String args[]) {

Scanner sc = new Scanner(System.in);

int side;

System.out.println("Please Enter side of the square to be printed");

side = sc.nextInt();

while(side < 0) { //This happens if you enter something like "-1". System.out.println("You have entered negative value. Enter side again!!");

side = sc.nextInt();

}

Asterisks as = new Asterisks(side);

as.displaySquare();

} }

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!