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
When one method calls another, which of the following statements are true?
jonny [76]

Answer:

I. The class methods and instance methods of one class may call the public class methods of another class using dot notation and referencing the name of the other class.

Explanation:

Private methods are being accessed from only within the class or scope specified. No other means of accessibility is possible, and even through inheritance. And instance methods can never call without using dot notation, any of the class method of the same class. Hence second and third options are not correct. And the class method and the instance methods of one class may call the public class methods of another class using the dot notation and referencing the name of the other class. Hence, the correct option is the first one.

3 0
3 years ago
You work as a Network Administrator for wwwpany Inc. You have suspected a bad driver or perhaps malware. Which of the following
vichka [17]

Answer:

Explanation:

There is a solution called ETA (Encrypted Traffic Analytics) this is a security advanced network that helps us to identify malware between the encrypted data, but with this tool is no necessary to break any protection and privacy chain.

This technology use machine learning to read all the traffic without deciphering it, in this way we can detect a difference between reliable and malicious traffic.

En windows we can use Microsoft Security Essentials like antivirus and detect virus, we can use Process Explorer, analyze the traffic, we can use Microsoft Network Monitor.

8 0
3 years ago
SOMEBODY HELP ME ASAP PLEASE AND THANK YOU
Paha777 [63]

Answer:

Isnt there another thing that is supposed to be there like some website

Explanation:

7 0
3 years ago
Read 2 more answers
Define the term output devices​
expeople1 [14]

So a output device is anything that can output info from the computer so

we are read and understand it some are a printer monitor and soundboard

Hope this helped

-scav

6 0
3 years ago
A user calls to report that she is experiencing intermittent problems while accessing the wireless network from her laptop compu
mel-nik [20]

Answer:

Interference of signal and the range between the user and the access point.

Explanation:

Elevators, specifically those with high voltage, are notoriously known for being a source of very strong magnetic fields. They produce a lot of harmonics that causes signal interference and noise. Whenever there is any kind of noise in a network, it causes huge intermittent connection. Also, the farther away the user is from the router or the AP, the weaker the signals and the more the intermittencies.  The user is recommended to be within the edges if the range limit.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Dan is a Civil Engineer for a company that builds nuclear power plants throughout the world. Which best describes the places he
    14·2 answers
  • What is the difference between HTML and CSS? * 1. CSS is a markup language unlike HTML 2. HTML is a backend technology and CSS i
    7·1 answer
  • A termination condition in a loop is analogous to________in a recursive method.
    11·1 answer
  • Typically, a CLEP exam is taken by students who
    8·1 answer
  • How a student can use computer to improve academic performance?
    7·2 answers
  • PASSAGE: The picnic had been scheduled for weeks in advance. The Morris family was looking forward to some fun and relaxation wi
    12·1 answer
  • Cuantos MB son 8,192 kb?​
    13·1 answer
  • 7.5 Code practice Plz answer ASAP
    15·1 answer
  • Need help please asap
    9·1 answer
  • 12. What are the additional elements required of a network architecture if the enclave is to support remote access through the p
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!