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
VMariaS [17]
3 years ago
8

Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (a

nd hopefully funny) ways.Write a program that takes a string and integer as input, and outputs a sentence using those items as below. The program repeats until the input string is quit 0.Ex: If the input is:apples 5shoes 2quit 0the output is:Eating 5 apples a day keeps the doctor away.Eating 2 shoes a day keeps the doctor away.Note: This is a lab from a previous chapter that now requires the use of a loop.import java.util.Scanner;public class LabProgram {public static void main(String[] args) {/* Type your code here. */}}

Computers and Technology
1 answer:
Marina86 [1]3 years ago
3 0

Answer:

I am writing a C++ and JAVA program.    

import java.util.Scanner; //for using input output functions

public class LabProgram { // class name

public static void main(String[] args) {//start of main function body

Scanner input = new Scanner(System.in);

// creates input instance of  Scanner type

     String str;  // declares String type variable str for a string value

     int num;  // declares integer type variable num to hold an integer value

     str = input.next(); //scans and reads input string from user

     num = input.nextInt();  //scans and reads input integer from user

//while loop continues to execute until user enters quit 0

while(str!="quit" && num!=0) {  

/* prints the following message, for example if value of num = 2 and value of str = apples then the following print statement prints Eating 2 apples a day keeps the doctor away. */

System.out.println("\nEating " + num +" " + str + " a day keeps the doctor away.");

//takes string and integer as input again and keep taking input until user //enters quit 0

str = input.next();  

num = input.nextInt(); }   } }

Explanation:

The program is well explained in the comments mentioned with each statement of the program. The program simply prompts user to enter a string and an integer. The while loop keeps executing until user enters quit 0. The program keeps taking input string and integer from user and prints the message System.out.println("\nEating " + num +" " + str + " a day keeps the doctor away.");  The loop breaks when the use enters quit 0. The screenshot of the program along with its output is attached.

You might be interested in
What are some examples and non-examples of digital security?
deff fn [24]

Answer:

Devices such as a smart card-based USB token, the SIM card in your cell phone, the secure chip in your contactless payment card or an ePassport are digital security devices

5 0
2 years ago
Initialize the tuple team_names with the strings 'Rockets', 'Raptors', 'Warriors', and 'Celtics' (The top-4 2018 NBA teams at th
dexar [7]

Answer:

Following is the code in python language

team_names = ('Rockets','Raptors','Warriors','Celtics')#holding the string value

print(team_names[0],team_names[1],team_names[2],team_names[3])#display

Output:

Rockets Raptors Warriors Celtics

Explanation:

Following is the description of above statement .

  • Create a dictionary "team_names" that is holding the string value Rockets Raptors Warriors and Celtics.
  • Finally we used the print function in that function we pass the index of corresponding dictionary i.e team_names[0] . it will display the first index value  similarly we pass  team_names[1], team_names[2]  team_names[3].
8 0
3 years ago
Do you agree that digital signatures are the best way to protect the data in question?
lutik1710 [3]

Answer:

Explained

Explanation:

Yes, I agree that digital signatures are the best way to protect the data in the date in question. A digital signature is mathematical technique used to validate the authenticity and integrity of a massage. Digital signature is far more inherent security. It is built to solve problems of tempering and impersonation of digital documents. It allows the authorized user to have authentic right, and the unauthorized person is denied access.

3 0
3 years ago
How fast is light? person that answers this will get points ​
Serhud [2]

299,792,458 metres per second

6 0
3 years ago
A program written in a(n) procedural language consists of sequences of statements that manipulate data items. __________________
Alenkasestr [34]

Answer:

true.

Explanation:

According to my research on information technology, I can say that based on the information provided within the question the statement is completely true. Procedural programming is a widely used paradigm that basically gives the program a set of routines or specifications, and the program mixes and matches them as they continuously repeat the process. It is used in many areas, including video game development.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
3 years ago
Other questions:
  • Write a program that inputs a line of text and uses a stack object to print the line reversed.
    14·1 answer
  • Random-access memory (RAM) is able to quickly access data because it is arranged in which of the following configurations?
    8·2 answers
  • Token stories of success and upward mobility (illustrated by Oprah, Ross Perot, and Madonna) reinforce ________ and perpetuate t
    8·1 answer
  • Sally needs to copy data from the first worksheet to the fifth worksheet in her workbook. Which combination of keys will she use
    6·2 answers
  • Write a C++ program to count even and odd numbers in array. The array size is 50. The array elements will be entered by the user
    13·1 answer
  • What is the FaFASA4caster used for
    10·1 answer
  • What will be the output of the following code?
    14·1 answer
  • Question in photo below
    13·2 answers
  • Algorithm to eat orange<br><br>​
    10·2 answers
  • 12. In Justify the text is aligned both to the right and to the left margins, adding extra space between words as necessary *
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!