QuestionQuestion

Homework

PROGRAM #1

HOLLOW RECTANGLE PROGRAM - Write a program that displays the following pattern (note you will need to use the escape sequences we learned in class to do this)

&&&&&&
&    &
&    &
&    &
&    &
&&&&&&

PROGRAM #2
DIAMOND PATTERN PROGRAM - Write a program that displays the following pattern (don't forget it must look exactly like the shape below, use the techniques we learned in class - on this program you can deviate from the exact shape just a bit if you'd like to use single spacing instead of double spacing to make it look more like a diamond).

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

PROGRAM #3
FAMOUS QUOTES PROGRAM - Write a program that displays the following information in the EXACT pattern/formatting shown below. You must use escape sequences to do this - this is not English class and things are written below to test you on escape sequences form class, so no matter what follow the pattern/formatting shown (the dashes and spaces do not have to be perfect but everything else should match, you should try to use tabs for the spacing - in addition you don't know how to program "bold" so you can ignore the bold).
Famous Person Profession Famous Quote
-------------     ----------- -------------
William Shakespeare       Playwright\Poet      "Listen to many, speak to a few."
Abraham Lincoln            President            "A house divided against itself cannot stand."
Renee Descartes            Mathematician       "Everything is self-evident."


Lab #1

Include source code and output. If no output explain the reason why and what you are going to do make sure it does not happen again aka learning from your mistakes.

PROGRAM #1

Define a problem with user input, user output and mathematical computation. Write the pseudocode, code and display output.

Problem:

Pseudocode:

Code:

Output:

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

Pseudocode:

Set user input to n
Set result to 1
Loop for i = 1 to i = n
result = result * n
Print result

Code:

import java.util.Scanner;

public class Lab1 {

public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    System.out.println("Lab1 - Factorial Program");
    System.out.print("Enter number: ");
    int n = s.nextInt();
    int result = 1;
    for (int i = 1; i <= n; i++) {
      result *= i;
    }
    System.out.println("Factorial result: " + result);
}

}...

By purchasing this solution you'll be able to access the following files:
Solution.zip and Solution.docx.

$45.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats