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
You've been given a network of 130.0.0.0 /16. you need to divide it into four VLSM subnets as follows:
Sidana [21]

Answer: Hello your required question is wrong as it does not tally with the data provided , attached below is the complete question

answer:

/23 /26 /27 /28   option A

Explanation:

<u>Breakdown of the last four subnet masks given to the subnets </u>

For the subnet of 500 production host the mask = /23 which will produce 512 hosts

For the subnet of 60 sales host the mask = /26 which will produce 64 hosts

For the subnet of  12 host the mask = /27 which will produce 32 hosts

For the subnet of 30 hosts the mask = /28 which will produce 16 hosts

4 0
3 years ago
Which components of the​ five-component model is commonly thought of as the​ "bridge" that links the computer side of the model
-Dominant- [34]

Answer:

The correct answer to the following question will be "Data".

Explanation:

  • Data would be any series of one or even more signs which are given significance by unique classification action. To become knowledge the data needs to be interpreted.
  • Data is generally considered to be the "bridge" that connects the designer's machine part with the practical side.

Therefore, this will be the right answer.

3 0
3 years ago
Which cell formatting is most likely to use $?
TiliK225 [7]
Currency is the correct answer
4 0
3 years ago
Read 2 more answers
Which of the following commands should you use to determine whether there are any shared resources on a Windows computer with th
Law Incorporation [45]

Answer:

c. nbtstat -a 193.145.85.202

Explanation:

Nbtstat is a TCP/IP utility which is used to display the current connections and statistics of TCP/IP using NetBIOS over TCP/IP (NetBT).

It is installed on a computer running Microsoft Windows when the TCP/IP protocol stack is installed.

Also, it is very useful when we want to troubleshoot NetBIOS name resolution problems.

One can run nbtstat -a < ComputerName > to obtain the local NetBIOS name table on <ComputerName> and its MAC address

7 0
3 years ago
Read 2 more answers
According to the reading on the course web pages, the earliest usage of cooking began around _____ million years ago.
fenix001 [56]

Answer:

According to the reading on the course web pages, the earliest usage of clothes began around ____ million years ago. 3.4 1.5 0.8 0.5 1.7 2. According to the reading on the course web pages, lime mortar was probably discovered from annealing: Charcoal Obsidian Flint Glass 3.

Explanation:

6 0
3 years ago
Other questions:
  • Raeball was a lovin doll. And she spoke her mind as she stood tall. She made you special and loved. You're missed by so many. An
    10·2 answers
  • How to access files on different computer same network
    14·1 answer
  • . Virtualization simplifies the use of resources, isolates users from one another, supports replication and mobility, but exacts
    7·1 answer
  • Multiple arrays. Jump to level 1 For any element in keysList with a value greater than 40, print the corresponding value in item
    7·2 answers
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    9·1 answer
  • Is amazon a e-commerce website <br> o true <br> o false
    8·2 answers
  • Which of the following does Secure Sockets Layer (SSL) use to authenticate a user or system before encrypting a session?
    14·1 answer
  • Animals living in burrows under the ground is an interaction between the biosphere and the
    11·1 answer
  • A network of computers that provides access to information on the web.
    15·2 answers
  • What does playstation network is currently undergoing maintenance?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!