subject

Preliminaries Create a project submission folder, in the form Lab#FirstNameLastName. For example, mine would be Lab5DavidLiu
Create an Eclipse Java Project.
Add a Java class named PatternMaker to your project
Exercises
Part 1) – For Loop and Pattern Set up – 14 points
The majority of the points come from setting up the lab to print patterns appropriately based on user input.
(a) Declare variables to store the following information
(a.1) The type of pattern the user wants (a String)
a.2) The amount of lines the user wants in the pattern (an int), numLines
(b) Ask the user the pattern they want. It should be either "square" or "rectangle" (no
quotes)
(c) Ask the user for the amount of lines they want.
(d) Use the method of your choice (if-elseif-else block or a switch statement) to
determine which pattern the user chose. If neither square or rectangle was entered, tell
the user to buzz off and end the program.
(e) If the pattern input is rectangle, print out a three wide rectangle of a symbol of your choice (such as *,#, or $) that is numLines lines long using a for loop to print that number of lines. (That is, run the loop from 0 to numLines).
(f) If the pattern input is for square, print out a numLines by numLines square of a symbol of your choice. This will required the use of print and nested for loop (a for loop for square width and a for loop for square height). Note that the outermost loop (the one that controls height) should print the newlines and the innermost loop (the one that controls width for each new row) should print symbols.
Sample input and output follows:
What pattern: rectangle
How many lines: 5
$$$
$$$
$$$
$$$
$$$
---
What pattern: square
How many lines: 2
**
**
---
What pattern: fish
How many lines: 25
You offend me, sir! The program is now done.
Part 2) File Time – 6 points
This part of the lab changes Part 1 to use output files
Make a new object, a PrintWriter object that opens the output file "Pattern. txt".
For the square and rectangle inputs, write the output to the file using PrintWriter rather than using console output
For the third case, where the program is offended, do not change the results
At the very end of the code, before the end of the main method, close the PrintWriter (and while you’re at it, close the Scanner too!) with the .close() method.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:30
Advantages and disadvantages of binary system
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
How do you set up a slide show to play continuously, advancing through all the slides without requiring your interaction? a. click set up slide show, and then select the loop continuously until ‘esc' and show without narration options. b. click set up slide show, and then select the loop continuously until ‘esc' and use timings, if present options. c. click set up slide show, and then select the show presenter view and use timings, if present options. d. click set up slide show, and then select the show without animation and browsed at a kiosk (full screen) options.
Answers: 3
question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
You know the right answer?
Preliminaries Create a project submission folder, in the form Lab#FirstNameLastName. For example, m...
Questions
question
Mathematics, 26.01.2020 05:31
Questions on the website: 13722362