1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tensa zangetsu [6.8K]
3 years ago
5

Write a program that can print a banner with rotated letters, such that they can be read from top to bottom. Specifically, each

letter in the message should be printed using multiple lines composed of * symbols. The code to print each letter should go into a separate method just for that letter (no parameters, no return value). Don’t worry, you don’t need to make 26 different methods, just 8: the seven letters in the message "Hello World" (D, E, H, L, O, R, and W) and a space. In your main method, you should ask the user to type a message. Then, loop through each character in the message and, for each character, if you have a corresponding method, call the method to print out the letter to the screen, ignoring any other characters. To help get you started, here is an example method for the letter D:
Computers and Technology
1 answer:
My name is Ann [436]3 years ago
4 0

Answer:

package Lab6Problema;

import java.util.Scanner;

public class Lab6Problema{

public static void H() // prints H

{

System.out.println();

System.out.println("** **");

System.out.println("** **");

System.out.println("******");

System.out.println("** **");

System.out.println("** **");

}

 

public static void E()//prints E

{

System.out.println();

System.out.println("******");

System.out.println("** ");

System.out.println("******");

System.out.println("** ");

System.out.println("******");

}

 

public static void L()//prints L

{

System.out.println();

System.out.println("* ");

System.out.println("* ");

System.out.println("* ");

System.out.println("* ");

System.out.println("******");

}

 

public static void O()//prints O

{

System.out.println();

System.out.println("******");

System.out.println("* *");

System.out.println("* *");

System.out.println("* *");

System.out.println("******");

}

 

public static void W()//prints W

{

System.out.println();

System.out.println("* *");

System.out.println("* *");

System.out.println("* ** *");

System.out.println("* ** *");

System.out.println("** **");

}

 

public static void R()//prints R

{

System.out.println();

System.out.println("***** ");

System.out.println("** **");

System.out.println("***** ");

System.out.println("** **");

System.out.println("** **");

}

 

public static void D()//prints D

{

System.out.println();

System.out.println("**** ");

System.out.println("* * ");

System.out.println("* *");

System.out.println("** * ");

System.out.println("**** ");

}

public static void blank() //prints blank space

{

System.out.println();

System.out.println();

System.out.println();

}

public static void main(String[] args) {

//just enter "Hello World" as input as specified

System.out.println("Enter a Message");

Scanner scan=new Scanner(System.in);

String myMessage=scan.nextLine(); // read msg using scanner

int numOfCharacters=myMessage.length();// calculate message lenth

for(int i=0;i<numOfCharacters;i++) // loop through each chracter in msg

{

// gets character at position i, and switch accordingly

switch(myMessage.charAt(i))

{

// if character is 'H' or 'h', call method H(). Similarly for other

// Hecharacters in message.

case 'H':

case 'h':H();break;

case 'E':

case 'e':E();break;

case 'L':

case 'l':L();break;

case 'O':

case 'o':O();break;

case 'W':

case 'w':W();break;

case 'R':

case 'r':R();break;

case 'D':

case 'd':D();break;

case ' ':blank();break;

}

}

}

}

Explanation:

You might be interested in
Finish the format string to get the output shown below.<br> Day<br> &gt;&gt;&gt;{ v8'_format('Day)
Lorico [155]

In C language, a Format string refers to a string utilized to format output or input. The complete format string is: >>>{% v8'_format('Day)

<h3>What is Format String?</h3>

In computer programming, a format string is a string that is used when formatting the input and output of functions.

It is responsible for the format of the input and output. In C language, it always starts with '%'.

Hence the completed format string will be: >>>{% v8'_format('Day).

Learn more about format strings ta:
brainly.com/question/26000102
#SPJ1

Learn more about Format String at:
brainly.com/question/26000102
#SPJ1

8 0
2 years ago
52.
OLEGan [10]
For the first one its NOW, I'm not sure about the 2nd, the 3rd I think is penal code cases but i could be wrong, and the 4th one sounds like voting is the most logical answer. 
7 0
3 years ago
Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, print "To
SVETLANKA909090 [29]

Answer:

<h2>Function 1:</h2>

#include <stdio.h> //for using input output functions

// start of the function PrintPopcornTime body having integer variable //bagOunces as parameter

void PrintPopcornTime(int bagOunces){

if (bagOunces < 3){ //if value of bagOunces is less than 3

 printf("Too small"); //displays Too small message in output

 printf("\n"); } //prints a new line

//the following else if part will execute when the above IF condition evaluates to //false and the value of bagOunces is greater than 10

else if (bagOunces > 10){

    printf("Too large"); //displays the message:  Too large in output

    printf("\n"); //prints a new line }

/*the following else  part will execute when the above If and else if conditions evaluate to false and the value of bagOunces is neither less than 3 nor greater than 10 */

else {

/* The following three commented statements can be used to store the value of bagOunces * 6 into result variable and then print statement to print the value of result. The other option is to use one print statement printf("%d",bagOunces * 6) instead */

    //int result;

    //result = bagOunces * 6;

    //printf("%d",result);

 printf("%d",bagOunces * 6);  /multiplies value of bagOunces  to 6

 printf(" seconds");

// seconds is followed with the value of bagOunces * 6

 printf("\n"); }} //prints a new line

int main(){ //start of main() function body

int userOunces; //declares integer variable userOunces

scanf("%d", &userOunces); //reads input value of userOunces

PrintPopcornTime(userOunces);

//calls PrintPopcornTime function passing the value in userOunces

return 0; }

Explanation:

<h2>Function 2:  </h2>

#include <stdio.h> //header file to use input output functions

// start of the function PrintShampooInstructions body having integer variable numCycles as parameter

void PrintShampooInstructions(int numCycles){

if(numCycles < 1){

//if conditions checks value of numCycles is less than 1 or not

printf("Too few."); //prints Too few in output if the above condition is true

printf("\n"); } //prints a new line

//else if part is executed when the if condition is false and else if  checks //value of numCycles is greater than 4 or not

else if(numCycles > 4){

//prints Too many in output if the above condition is true

printf("Too many.");

printf("\n"); } //prints a new line

//else part is executed when the if and else if conditions are false

else{

//prints "N: Lather and rinse." numCycles times, where N is the cycle //number, followed by Done

for(int N = 1; N <= numCycles; N++){

printf("%d",N);

printf(": Lather and rinse. \n");}

printf("Done.");

printf("\n");} }

int main() //start of the main() function body

{    int userCycles; //declares integer variable userCycles

   scanf("%d", &userCycles); //reads the input value into userCycles

   PrintShampooInstructions(userCycles);

//calls PrintShampooInstructions function passing the value in userCycles

   return 0;}

I will explain the for loop used in PrintShampooInstructions() function. The loop has a variableN  which is initialized to 1. The loop checks if the value of N is less than or equal to the value of numCycles. Lets say the value of numCycles = 2. So the condition evaluates to true as N<numCycles  which means 1<2. So the program control enters the body of loop. The loop body has following statements. printf("%d",N); prints the value of N followed by

printf(": Lather and rinse. \n"); which is followed by printf("Done.");

So at first iteration:

printf("%d",N); prints 1 as the value of N is 1

printf(": Lather and rinse. \n");  prints : Lather and rinse and prints a new line \n.

As a whole this line is printed on the screen:

1: Lather and rinse.

Then the value of N is incremented by 1. So N becomes 2 i.e. N = 2.

Now at second iteration:

The loop checks if the value of N is less than or equal to the value of numCycles. We know that the value of numCycles = 2. So the condition evaluates to true as N<numCycles  which means 2=2. So the program control enters the body of loop.

printf("Done."); prints Done after the above two lines.

printf("%d",N); prints 2 as the value of N is 2

printf(": Lather and rinse. \n");  prints : Lather and rinse and prints a new line \n.

As a whole this line is printed on the screen:

2: Lather and rinse.

Then the value of N is incremented by 1. So N becomes 2 i.e. N = 3.

The loop again checks if the value of N is less than or equal to the value of numCycles. We know that the value of numCycles = 2. So the condition evaluates to false as N<numCycles  which means 3>2. So the loop breaks.

Now the next statement is:

printf("Done."); which prints Done on the screen.

So as a whole the following output is displayed on the screen:

1: Lather and rinse.

2: Lather and rinse.

Done.

The programs along with their outputs are attached.

6 0
2 years ago
When you open as many links as you want, and still stay in the same browser window instead of cluttering your screen with multip
emmainna [20.7K]

Answer:

a. Tabbed browsing

Explanation:

Tabbed browsing is a feature in the browser that helps in operating several tabs at the same time. It helps in browsing different links without opening different browsers. Multiple pages can be opened and surfed at the same time in one window. Any link can be opened in a different or new tab by clicking right on the link. After this, 'open link in new tab' is to be selected and the link gets opened respectively.

3 0
2 years ago
What is some effective writing techniques?
scoray [572]
Be persuasive, have form, and know what you are talking about. I would recommend using MELCON.  You can learn more about MELCON with this link.  http://melcon.weebly.com/
3 0
2 years ago
Other questions:
  • How does the use of modules provide flexibility in a structured programming design?
    14·2 answers
  • All of the following are recommended to secure a wireless network EXCEPT:
    5·2 answers
  • Why are cable networks such as mtv and cnn more profitable than the big four broadcast networks?
    8·1 answer
  • Ryan is the operations manager for a national financial company. His company is in the process of creating a customer handbook.
    13·1 answer
  • What is the purpose of exporting your public key to the directory services server?
    11·1 answer
  • Why would an IT technician ever have to change out a computer’s motherboard?
    5·2 answers
  • What is a multipurpose network device?
    10·1 answer
  • If a system contains 1,000 disk drives, each of which has a 750,000- hour MTBF, which of the following best describes how often
    15·1 answer
  • What is the meaning of FTTH
    9·2 answers
  • How to transfer polygon from eth to polygon in ledger live
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!