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
________ is a method for addressing, creating, updating, or querying relational databases.
lorasvet [3.4K]
Structured Query Language<span> (</span>SQL<span>)</span>
4 0
3 years ago
A(n) ________ is usually a live broadcast of audio or video content. Select one: A. instant message B. webcast C. podcast D. wik
navik [9.2K]

Answer: B webcast

Explanation:

A webcast is a technology that allows the live broadcast of an audio or video event on the Internet. It is also known as Web lecture, virtual meeting, etc. The major advantage is that it gives room for an event to have a larger reach. Webcast participation can be through PC, smart phones, tablets and other devices with quality Internet access.

7 0
3 years ago
Read 2 more answers
Which amendment applies to the following scenario? “Brian attended church with his two daughters and wife on Sunday." A First B
iragen [17]

Answer: First Amendment

Explanation:

The First Amendment gives individuals the freedom of speech and the right to proactive any religion that they want. It also allows the people have a peaceful protest.

The swcud amendment gives people the right to keep arms. The Fourth hinders individuals from being searched without a warrant.

Therefore, the answer is First Amendment.

4 0
3 years ago
Differences between analog computer and hybrid computer​
aleksandrvk [35]

Answer:

Analog computers only work with continuous numerical data in analog quantities, digital computers can process both non-numerical and numerical data and a hybrid computer is a combination of both analog and digital. A hybrid computer has the accuracy of a digital computer paired with speed of an analog one.

5 0
3 years ago
Read 2 more answers
Applying what formatting option to your excel workbook will make it easier to read when printed out?
blagie [28]
Portrait, as well as 100 percent scale.
8 0
2 years ago
Other questions:
  • A communications system connecting two or more computers is called a(n) ________.
    7·1 answer
  • When creating an input control (for example, a button) on a form the _____________ indicates the data that is contained in the n
    13·1 answer
  • What type of lights are necessary for silhouettes?
    12·2 answers
  • An iPad Is An Example Of Which Type Of Computer?
    11·2 answers
  • Write a query to show the price reduced by 10% for all products that are tables or entertainment centers with a standard price g
    10·1 answer
  • Write a program that generates a random number between 5 and 15 and asks the user to guess what the number is. If the user’s gue
    5·1 answer
  • . A wireless ……..is a device used to resolvewireless network connectivity problems.
    8·1 answer
  • Someone please tell me please y my ps4 controller won’t charge:(
    12·2 answers
  • Ask how many apples the user wants. Ask how many people the user will share the apples with. Find out how many apples will remai
    7·1 answer
  • A large number of genetic codes are stored as binary values in a list. Which one of the following conditions must be true in ord
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!