Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

* *** ***** ******* ***** *** * Write a program that displays the followingpattern: Output . Seven lines of output as follows: The first consists

*
***
*****
*******
*****
***
*

Write a program that displays the followingpattern:

Output . Seven lines of output as follows: The first consists of3 spaces followed by a star. The second line consists of 2 spacesfollowed by a 3 stars. The third consists of one space followed by5 stars, and the fourth consists just of 7 stars. The fifth line isidentical to third, th sixth to the second and the seventh to thefirst.

CLASS NAMES. Your program class should be called StarPattern

I NEED iIT TONIGHT! IT MUS TBE In JAVA PROGRAMMING......I triedbut getting a lot of errors..when i enter it in the myprogramminglab -BADLY NEED HELP!

public class StarPattern

{ public static void main(String[] args) { finalint rows =7; intspaces = rows/2; intstars = 1; for(inti = 0; i < rows; i++){ for(intj = 0; j < spaces; j ++){ System.out.print(""); }for(intj = 0; j < stars; j ++){ System.out.print("*"); }System.out.println(); if(i< rows/2){ spaces--; stars+= 2; }else{ spaces++; stars-= 2; } } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting

Authors: Jonathan E. Duchac, James M. Reeve, Carl S. Warren

23rd Edition

978-0324662962

More Books

Students also viewed these Accounting questions