In Java
We want to print the character “*” as the following pattern. For example, for n = 5, we have a 5*5 square in the middle and then for 5 rows and columns no character is printed and then then boundary is created using the 5 asterisks.
Write a function that gets the odd number input argument n and creates the pattern above. Test your program with n = 3 and 5.
|
Your code for this problem |
|
-- Copy and paste your code here |
Run the code for two cases with n = 3 and n = 5. Insert the result in the following box.
|
The result of the query |
|
Copy and paste the result here (e.g. the screen shot of the result you get by running the code). |
import java.util.Scanner;
public class pattern {
public static void main(String[] args) {
System.out.println("Enter the n value:");
//To take the input from user
Scanner var = new Scanner(System.in);
int n = var.nextInt();
//loops to print the required pattern
for(int i=0;i<n*5;i++)
{
// condition for first and last
iteration
if(i<n|| i > (n*4)-1)
for(int j=0;j<n*5;j++)
{
System.out.print("*");
}
// condition for center iteratiom
else if(i>((n*2)-1) &&
i<(n*3))
for(int j=0;j<n*5;j++)
{
if((j> (n-1) &&
j<(n*2)) || (j>((n*3)-1)&& j<(n*4)))
System.out.print(" ");
else
System.out.print("*");
}
// condition for remaining
iterations
else
for(int j=0;j<n*5;j++)
{
if(j>(n-1)&& j <
(n*4))
System.out.print(" ");
else
System.out.print("*");
}
System.out.println("");
}
}
}
![import java.util.Scanner; mt no public class pattern { 00 public static void main(String[] args) { Fam System.out.println(En](http://img.homeworklib.com/questions/2ad21770-7882-11eb-aed5-a75384f9701f.png?x-oss-process=image/resize,w_560)



In Java We want to print the character “*” as the following pattern. For example, for...
In Parts This Skill Builder will require you to write several functions in which loops will be the focus. In addition, some of these function will require you to design and implement finite state machines. So, let's get started! The template below has a class called SkillBuilder6 with a set of skeleton methods provided. The requirements for each method is provided below Left Triangle In the template below, SkillBuilder6 has a method with the following signature: public static String leftRightTriangle...
CIS 411w spring 2017 Problem Set 11 1 Log in to your Oracle ApEx account. 2. Create a new table called email with this command: CREATE table email as (SELECT empno, ename||'.'||SUBSTR(JOB,1,2)||'@apex.com' as "EMAIL" from emp); Click à Run to create this table 3. Write a SQL query that JOINS the three tables emp,dept and email. This SQL query will return the empno, ename, job, sal, loc and email for each employee. Use the newer ANSI JOIN syntax rather...
Task Algorithms: Pattern Matching (in java) Write a program that gets two strings from user, size and pattern, and checks if pattern exists inside size, if it exists then program returns index of first character of pattern inside size, otherwise it returns -1. The method should not use built-in methods such as indexOf , find, etc. Only charAt and length are allowed to use. Analyze the time complexity of your algorithm. Your solution is not allowed to be> = O...
Accumulation Pattern Problem 2 Consider the code below. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 labs = ['lab1', 'lab2', 'lab3', 'lab4', 'lab5', 'lab6', 'lab7', 'lab8', 'lab9'] graded = '' for lab in labs: lab_num = int(lab[3]) if lab_num < 4: graded = graded + lab + ' is simple\n' elif lab_num < 7: graded = graded + lab + ' is ok\n' else: graded = graded + lab + ' is complex\n' ...
Nay
programming languge is fine (MatLab, Octave, etc.)
This is the whole document this last picture i sent is the
first page
5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...
using c language String Challenge Have the function StringChallenge(str) read str which will contain two strings separated by a space. The first string will consist of the following sets of characters: +, *, $, and {N} which is optional. The plus (+) character represents a single alphabetic character, the ($) character represents a number between 1-9, and the asterisk (*) represents a sequence of the same character of length 3 unless it is followed by {N} which represents how many...
Parallelogram Program
Write a program that prints the following parallelogram pattern
given the the following two inputs.
Here are the rules:
Your program must work with any length greater than 1.
Your program must use the character the user inputs to draw the
parallelogram.
Your program must not use global variables or global code other
than a call to main().
Your program output must match my out
exactly. I have provided you with the
strings you need for the output...
IN JAVA Overview In this project you will implement a Java program that will print several shapes and patterns according to uses input. This program will allow the use to select the type (say, rectangle, triangle, or diamond), the size and the fill character for a shape. All operations will be performed based on the user input which will respond to a dynamic menu that will be presented. Specifically, the menu will guide the user to decide between different forms...
JAVA PROJECT Part 1 - Normalize Text The first thing we will do is normalize the input message so that it’s easier to work with. Write a method called normalizeText which does the following: Removes all the spaces from your text Remove any punctuation (. , : ; ’ ” ! ? ( ) ) Turn all lower-case letters into upper-case letters Return the result. The call normalizeText(“This is some \“really\” great. (Text)!?”) should return “THISISSOMEREALLYGREATTEXT” Part 2 - Obfuscation...
In C++ please. Thank you!! #include <iostream> #include <cstring> // print an array backwards, where 'first' is the first index // of the array, and 'last' is the last index void writeArrayBackward(const char anArray[], int first, int last) { int i = 0; for (i = last; i >= first; i--) { std::cout << anArray[i]; } std::cout << std::endl; } // test driver int main() { const char *s = "abc123"; writeArrayBackward(s, 0, strlen(s) - 1); } // Using the...