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
  • Zeller's congruence is an algorithm developed to calculate the day of the week. Write a program...

    Zeller's congruence is an algorithm developed to calculate the day of the week. Write a program that prompts the user to enter a year, month, day of month and it displays the name of the week. Here is my source code. I need it broke down into a flowchart. public static void main(String[] args) {        //all variables are initialized to 0, because local variables require at least an initial value before use        Scanner input = new...

  • 1. Write a function in Tree class which returns true if and only if the tree...

    1. Write a function in Tree class which returns true if and only if the tree satisfies the binary search tree property. The function’s header line is public boolean isValidBST() And in the attached code, you just need to finish the function after the comment: “//Instructor hint: please write your code here:” Make sure you execute your code, and the result in the main function after calling your function should be same as the prompt message I write. Clearly you...

  • Need help in the below question. Answer in java Start with the tree.java program (Listing 8.1)...

    Need help in the below question. Answer in java Start with the tree.java program (Listing 8.1) and modify it to create a binary tree from a string of letters (like A, B, and so on) entered by the user. Each letter will be displayed in its own node. Construct the tree so that all the nodes that contain letters are leaves. Parent nodes can contain some non-letter symbol like +. Make sure that every parent node has exactly two children....

  • I'm working on a java program where I'm supposed to convert 4 bit binary into decimal....

    I'm working on a java program where I'm supposed to convert 4 bit binary into decimal. I went with if statements and tried to use an else to print out an error message if the user enters a number that isn't a binary number but it prints no matter what. (so, it prints that it's a vowel and that it's not a vowel) 1 import java.util.Scanner; 2 3 public class HomeworkTwoQ2 4 { 5 6 public static void main(String[] args)...

  • 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...

  • 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...

  • Java Programming The program template represents a complete working Java program with one or more key...

    Java Programming The program template represents a complete working Java program with one or more key lines of code replaced with comments. Read the problem description and examine the output, then study the template code. Using the problem-solving tips as a guide, replace the /* */ comments with Java code. Compile and execute the program. Compare your output with the sample output provided. Modify class Time2 to include a tick method that increments the time stored in a Time2 object...

  • 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...

  • Using Merge Sort: (In Java) (Please screenshot or copy your output file in the answer) In...

    Using Merge Sort: (In Java) (Please screenshot or copy your output file in the answer) In this project, we combine the concepts of Recursion and Merge Sorting. Please note that the focus of this project is on Merging and don't forget the following constraint: Programming Steps: 1) Create a class called Art that implements Comparable interface. 2) Read part of the file and use Merge Sort to sort the array of Art and then write them to a file. 3)...

  • 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[]...

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
ADVERTISEMENT