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
Can Any body Define what is search engine in a simple language quick please​
Komok [63]

Answer:

It is the SQL of WWW. Or in other words, it is the web tool that helps the users in locating the required information on the WWW. Various top search engines are like Google, MSN, and Yahoo. And the information that is gathered by the spider is used for creating the searchable index for the content on the web. This spider crawls according to the search engine algorithm and that is known as web crawling.

Explanation:

Please check the answer section.

6 0
3 years ago
According to ________ law, in a sealed chamber, the pressure and temperature of a gas are directly related to each other.
Vaselesa [24]

Gay- Lussac's Law.  <span>A law stating that the volumes of gases undergoing a reaction at constant pressure and temperature are in a simple ratio to each other and to that of the product</span>

<span>.</span>


6 0
3 years ago
Traditionally, remote administrative access on routers was configured using Telnet on TCP port 23. However, Telnet was developed
FinnZ [79.3K]

<u>Explanation</u>:

It is an all-too-often used technology today in connecting several computers together via a network.

Routing simple terms means the action of selecting the path taken by the traffic of data in a network of computers. The routing systems involve the use of both wireless and cable based architectures. Some common example of routing systems includes:

  1. Dynamic Routing
  2. Static routing
  3. Default Routing
5 0
3 years ago
What is log in and log out?
Brums [2.3K]
Log in is the feature that allows you to access your electronic account in a website, database or other, also a bank account. Your username and password are stored in cookies  (files that websites use and are stored in your browser) for the session. This is true if we talk about websites.

When you're done, you log out from your account, you disconnect. Cookies are cleared (for websites) and you're out.
8 0
3 years ago
The AutoRecovery feature would be useful for which situations? Check all that apply.
Aliun [14]

Answer:

All of the above but I'm not 100% sure.

5 0
3 years ago
Other questions:
  • This question involves the creation of user names for an online system. A user name is created based on a user’s first and last
    13·1 answer
  • According to the appendix what was the purpose of newspeak
    12·1 answer
  • The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n _
    14·1 answer
  • The network layer of the Internet model uses the _____________ protocol to route messages though the network.
    13·1 answer
  • You coded the following class: public class N extends String, Integer { }When you compile, you get the following message:N.java:
    9·1 answer
  • What type of device is the keyboard?<br><br> Output<br> Input<br> Monitoring<br> Software
    7·2 answers
  • You can use this type of program to create a new raster image
    9·1 answer
  • Vpn stands for _____. very precise settings virtual private network virtual public network vice prestigious setup
    5·1 answer
  • Which option represents the location of the Goal Seek function?
    8·2 answers
  • Hey im b---o---r---e---d dont report cuz if u do ur l a m e :)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!