Question: Q4. The Flag class given below has a size field that sets the width and height of a flag. begin{tabular}{l} public class Flag { private

 Q4. The Flag class given below has a size field thatsets the width and height of a flag. \begin{tabular}{l} public class Flag\{ private int size; . \\ \hline \end{tabular} The driver program is

Q4. The Flag class given below has a size field that sets the width and height of a flag. \begin{tabular}{l} public class Flag \{ private int size; . \\ \hline \end{tabular} The driver program is given below: public static void main(String[] args) \{ Flag f= new F lag(); f.printFlag(); f. doublesize(); f.printFlag(); f. doublesize(); f.printFlag() ; \} The output is given below: A. Write a constructor that initializes the size field with the integer value 5 . B. Write a method doublesize that doubles the value of the size field. C. Write a method printFlag that prints the flag with size asterisks () on each side and size asterisks along the right diagonal

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!