Question

Write a program that prints an imitation of the Composition II in Red, Blue, and Yellow created in 1930 by Piet Mondrian painting, illustrated below. Use character sequences such as @@a or: to indicate different colors and use - and| to form the black lines. with algorithm public class Solution - public static void main(String[] args) { for(int FI ;İ<-50;İ++){ for(int Hj<-50;jt+){ if(j-12) { System.out.print(! ); } else ifj>12 && і 39){ System.out.print(@ ); 3 else if(i--39)\ System.out.print( -); } else ifti-39 && j〈12) { System.out.prinu. ); } else ifjく12 && і==15){ System.out.print-); } else ifi-39 && İ-45 System.out.print(ן ); } else ifi--45 &&j245){ System.out.print- ); 3 else iffi>45 && j>45) System.out.print(% ); } else { System.out.print ); System.out.println); } I I have this java code but it gives me long output error in browxy compiler
0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

public class Solution{

public static void main(String[] args) {

for(int i=1; i<=50; i++){

for(int j=1; j<=50; j++){

if(j==12){

System.out.print("|");

}

else if(j>12 && i<39){

System.out.print("@");

}

else if(i==39){

System.out.print("-");

}

else if(i>39 && j<12){

System.out.print(":");

}

else if(j<12 && i==15){

System.out.print("-");

}

else if(i>39 && j==45){

System.out.print("|");

}

else if(i==45 &&j>45){

System.out.print("-");

}

else if(i>45 && j>45){

System.out.print("%");

}

else{

System.out.print(" ");

}

}

System.out.println();

}

}

}

nagaraju@nagaraju-Vostro-3550:/Desktop/CHEGG/November/061120185 javac Solution.java nagaraju@nagaraju-Vostro-3550:~/Desktop/CHEGG/Novenber/06112018$ java Solution

Add a comment
Know the answer?
Add Answer to:
Write a program that prints an imitation of the Composition II in Red, Blue, and Yellow...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assignment 6, Merge Arrays (java) Instructions In this assignment, you will write a program which merges...

    Assignment 6, Merge Arrays (java) Instructions In this assignment, you will write a program which merges two arrays of positive integers and removes any duplicate entries. Your program will first ask for a valid length which must be an integer which is 10 or greater. The program should continue to ask until a valid length is entered. The program will then create two arrays of the length entered, fill these with random integers between 1 and 100 inclusive, and print...

  • Copy the following java codes and compile //// HighArray.java //// HighArrayApp.java Study carefully the design and...

    Copy the following java codes and compile //// HighArray.java //// HighArrayApp.java Study carefully the design and implementation HighArray class and note the attributes and its methods.    Create findAll method which uses linear search algorithm to return all number of occurrences of specified element. /** * find an element from array and returns all number of occurrences of the specified element, returns 0 if the element does not exit. * * @param foundElement   Element to be found */ int findAll(int...

  • Write a program that reads in BabyNames.txt and produces two files, boynames.txt and girlnames.txt, separating the...

    Write a program that reads in BabyNames.txt and produces two files, boynames.txt and girlnames.txt, separating the data for the boys and the girls, and listing them in alphabetical order. This is the code I have, Its not sorting the boys/girls names in seperate files. It is creatinf two files, but has all the names. I also need to alphabetize the names. with an Array. sort import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class BabyNames{ public static void main(String[]...

  • Declare and initialize 4 Constants for the course category weights: The weight of Homework will be...

    Declare and initialize 4 Constants for the course category weights: The weight of Homework will be 15% The weight of Tests will be 35% The weight of the Mid term will be 20% The weight of the Fin al will be 30% Remember to name your Constants according to Java standards. Declare a variable to store the input for the number of homework scores and use a Scanner method to read the value from the Console. Declare two variables: one...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT