Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started