Indiana University Java Code Roflcopte Project

User Generated

yhnltunyvo

Programming

Indiana University Purdue University Indianapoli

Description

to create a java code that implements Roflcopter using specific instruction that is found in the paper and the texts files attached.

Unformatted Attachment Preview

:LOL:ROFL:ROFL | L /--------O === []\ L \ \ \___________] | | ----------/ ROFL:ROFL:LOL: | /--------LOL=== []\ \ \ \___________] | | ----------/ Roflcopter is regarded as one of the earlier internet memes. If you’re a traditional college student (in age), roflcopter is likely before your time, but it’s categorized as animated ASCII art – it’s just not very good art. It can be easily rendered in our Eclipse Java console using the concepts we’ve covered in the class up till now including: File IO, loops, input scanner, decision making, and printing. General Functionality: I’ve attached two text files that you will print out 20 times each, creating the effect of moving roflcopter blades. After the twenty print outs of each file, the user should be prompted to ask if they want to watch roflcopter again. The valid user input should ‘y’ or ‘Y’ if they want to watch again, else the program should terminate for any other input. I will check you program that it accepts lower case ‘y’ and upper case ‘Y’. Creating the animated effect: Yes, you’ll have to print the individual files out the console, however, to give it the animated effect, there are two additional things we need to do: 1. Pause the execution for a fixed time 2. Clear the screen After we print out one of the files, we need to pause the execution for a fraction of a second; the console prints out characters too fast for use to have enough time to see the rolfcopters. For this execution pause, please use the following command: Thread.sleep(milliseconds); Where for milliseconds, you should type in the integer literal for the total amount of milliseconds you want to pause execution for. Play around with this number to create a reasonable roflcopter animation. Remember I said it’s going to be less than a second and there are 1000 milliseconds in a second. There’s not really a right or wrong time, just make the animation reasonable for someone to see. After we’ve printed out one of the roflcopters and paused the execution, we need to clear the screen. We can leverage the console’s ability to print out too fast so that to one’s eye, we don’t really perceive it printing out line breaks. Create a method called clearScreen() you can call from main() that will print out System.out.println() 10 times using a loop. Additional constraints: The reading of and printing out the files must be carried out by a method call to: public static void readFile(String fileName) throws FileNotFoundException { } I gave you this method heading because it required a throws argument, which has never been required of you before. You’ll need the throws FileNotFoundException in your main() as well. This method accepts the filename as a string input and the method’s body will read in the file using a loop WITHOUT HARDCODING the total number of loops. Please take a look at our lecture presentation notes on reading in a file using loops. For each iteration of the loop, the read in line should be printed out until the end of the file has been reached. Then, #1 and #2 (above) should be called. After printing the first file, print out the second file in the same fashion. The functionality of printing the roflcopter animation and then prompting the user if you want to watch again should be carried out by nested loops: the inner loop to print out the roflcopters and the outer loop that prompts the user. To recap the coding requirements… Two methods other than main(): • • clearScreen readFile Loops: • • • Nested set of loops in main() o An inner loop and an outer loop A loop in clearScreen A loop to read and print the file
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer


Anonymous
Really useful study material!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags