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, 23.06.2019 09:20
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
question
Computers and Technology, 24.06.2019 13:50
Write a program that performs a simple n-body simulation, called "jumping leprechauns." this simulation involves n leprechauns, numberd 1 to n. it maintains a gold value g_i for each leprechaun i, which begins with each leprechaun starting out with a million dollars worth of gold, that is, g_i = 1000000 for each i = 1,. in addition, the simulation also maintains, for each leprachaun,i, a place on the horizon, which is represented as a double-precision floating point number, x_i. in each iteration of the simulation, the simulation processes the leprachauns in order. processing a leprachaun i during its iteration begins by computing a new place on the horizon for i, which is determined by the assignment:
Answers: 3
question
Computers and Technology, 24.06.2019 17:40
Write a program to analyze student’s scores. each student’s id and 4 original test scores are saved in the attached file “student_id_scores.txt”. assume there are exactly 15 students in the class.• the program first opens the file, reads student’s ids and scores from the file and saves them in two arrays: o create a one-dimensional string array “ids” to store the student’s ids.o create a (parallel) two-dimensional int array “scores” to store student’s original test scores. this array has 5 columns, the original 4 test scores should be saved in the first 4 columns, and the last column will be used to save the average score after the calculation in next step.• the program then retrieves test scores from the array “scores”, calculates average score and determines the final letter grade based on the rules in the table below for each student. assume average score is integer value.average score = (score1 + score2 + score3 + score4) / 4average score letter grade90 ~ 100 a80 ~ 89 b70 ~ 79 c60 ~ 70 d0 ~ 60 f• the average score should be saved back in the 5th column of “scores” array.• create a new parallel one-dimensional char array “grades” to save each student’s letter grade.• program also needs to find the number of a, number of b, number of c, number of d and number of f grade. as well as the highest, lowest and average score of the class.• finally, program will display all of the original scores and all results on the computer screen using the format shown as the sample output below.• the program must contain at least the following functions: (1) a function “getscores” to read and store data into “ids” and “scores” arrays.(2) a function “analyzescores” to calculate student’s average score, determine letter grade, get the number of a, b, c, d and f, find the highest, lowest and average score of the class.(3) a function “displayresults” to display all of the results
Answers: 3
question
Computers and Technology, 24.06.2019 23:00
Aselect query joins tables together by their a. table names. b. primary keys. c. first entries. d. field names.
Answers: 2
You know the right answer?
Preliminaries Create a project submission folder, in the form Lab#FirstNameLastName. For example, m...
Questions
Questions on the website: 13722362