[SOLVED] CSE110 Lab 8

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Lab08-Starlab-Java-c0yu2x.zip (333.4 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

Lab 7

Rules:

  •   You are not allowed to use any array or String
  •   One only line where the word “String” may appear is in public static void main(String [] args) {
  •   The word “char” must not be anywhere in your solutionOverall hint: Imagine all outputs as a matrix of space and star. Then count spaces and stars to find out the trend of increment or decrement of number of stars/spaces. Utilize several to control when ‘star’ will be printed, when ‘space’ will be printed and when ‘ will be printed.

    PROBLEM 1) Number Line Sample input:
    6
    Sample output

    123456

    PROBLEM 2) Star Line
    Print as many stars as given in input Sample input:
    6
    Sample output
    ******

    PROBLEM 3) Rectangle Sample input:
    4
    6

    Sample output

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

    Hint: 4 and 6 means 4 lines of stars having 6 stars in each line.

    PROBLEM 4) Rectangle Sample input:
    4
    6

    Sample output

    123456
    123456
    123456
    123456
    
    Hint: 4 and 6 means 4 lines of numbers having 1..6 in each line.
    

IF statement

enter’

Page 1 of 7

PROBLEM 5) Triangle – Left Justified
Draw right angled triangle of given height Sample input:
4
Sample output
*
**
***
****

Hint: One loop for lines, another loop for printing i number of starts when it is line i.

PROBLEM 6) Triangle – Left Justified
Draw right angled triangle of given height Sample input:
4
Sample output
1
12
123
1234

PROBLEM 7) Triangle – Right Justified Draw right angled triangle of given height Sample input:
4
Sample output

* ** *** ****

Hint: Count and print appropriate number of spaces in front of stars. Notice that there is one less space and one more star in each line.

PROBLEM 8) Triangle – Right Justified Draw right angled triangle of given height Sample input:
4
Sample output

1 12 123 1234

Page 2 of 7

PROBLEM 9) Triangle – Isosceles Draw triangle of given height Sample input 1:
3

Sample output 1:

* *** *****

Sample input 2: 4
Sample output 2:

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

PROBLEM 10) Triangle – Isosceles Draw triangle of given height Sample input 1:
3

Sample output 1:

1 123 12345

Sample input 2: 4
Sample output 2:

   1
  123
 12345
1234567

PROBLEM 11) Triangle – Right Justified Draw right angled triangle of given height Sample input:
4
Sample output

4 34 234 1234

Page 3 of 7

PROBLEM 12) Rhombus
Just draw the image of the above triangle once. And then, the opposite, once. Sample input:
3
Sample output

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

PROBLEM 13) Rhombus
Just draw the image of the above triangle once. And then, the opposite, once. Sample input:
3
Sample output

  1
 123
12345
 123
  1

PROBLEM 14) Hollow Rectangle
Display a rectangle of given length and width. Sample input:
4
5
Sample output
*****
**
**
*****

Hint 1: Print the character space (‘
Hint 2: You can re-use your solution to PROBLEM 2 and use if condition to selectively print first and last star of each line and all stars of first and last line.

PROBLEM 15) Hollow Rectangle
Display a rectangle of given length and width. Sample input:
4
5
Sample output
12345
15
15
12345

‘) in the middle.

Page 4 of 7

PROBLEM 16) Hollow Triangle – Left Justified Draw right angled triangle of given height Sample input:
5

Sample output

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

PROBLEM 17) Hollow Triangle – Left Justified Draw right angled triangle of given height Sample input:
5

Sample output

1
12 13 14 12345

PROBLEM 18) Hollow Triangle
Draw right angled triangle of given height Sample input:
5
Sample output

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

PROBLEM 19) Hollow Triangle – Right Justified Draw right angled triangle of given height Sample input:
5

Sample output

5 45 35 25 12345

Page 5 of 7

PROBLEM 20) Hollow Triangle Draw triangle of given height Sample input 1:
3

Sample output 1:

* ** *****

Sample input 2: 4
Sample output 2:

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

PROBLEM 21) Hollow Triangle – Isosceles Draw triangle of given height
Sample input 1:
3

Sample output 1:

1 13 12345

Sample input 2: 4
Sample output 2:

1 13 15 1234567

PROBLEM 22) Hollow Rhombus
Just draw the image of the above triangle once. And then, the opposite, once. Sample input:
3
Sample output

* ** ** ** *

Page 6 of 7

PROBLEM 23) Hollow Rhombus
Just draw the image of the above triangle once. And then, the opposite, once. Sample input:
3
Sample output

1 13 15 13 1

PROBLEM 24) Palindrome Sample input:
5
Sample output 123454321

PROBLEM 25) Palindromic Triangle Sample input:
5
Sample output

    1
   121
  12321
 1234321
123454321

 

  • Lab08-Starlab-Java-c0yu2x.zip