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
Gekata [30.6K]
3 years ago
11

Print "Censored' if userlnput contains the word "darn, else print userlnput. End with newline. Ex: If userinput is "That darn ca

t., then output is: Censored Ex: If userlnput is "Dang, that was scary!", then output is: Dang, that was scary! Note: If the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report Program end never reached. The system doesn't print the test case that caused the reported message. 1 import java.util.Scanner; 3 public class CensoredWords 4public static void main ( 1 test passed String args) Scanner scnr -new Scanner(System.in); String userInput; A tests passed userInput scnr.nextLine); 10 Your solution goes here 12 13 Run
Computers and Technology
1 answer:
sasho [114]3 years ago
6 0

Answer:

The code is given below in Java with appropriate comments

Explanation:

//Import the input.

import java.util.Scanner;

class CensoredWords

{

    //Define the main method.

    public static void main(String args[ ])

    {

         //Define the variables.

         String userInput="" ;          

         //Define the scanner object

         Scanner scobj = new Scanner(System.in);

          //Accept the userInput.

         System.out.print("Enter String: ");

         userInput=scobj.nextLine();

         //Check if the input contains darn.

         //Print censored.

         if(userInput.toUpperCase().indexOf("DARN") != -1)

         System.out.printf("Censored");

         //IF the input does not contains darn

         //Print userInput.

         else

System.out.printf(userInput)

         return;

}

}

You might be interested in
What is the output of the second println statement in the main method, public class foo { int i ; static int s ; public sttic vo
Sedaia [141]

Answer:

b) f2.i is 1 f2.s is 2

Explanation:

i is an instance variable and s is static, shared by all objects of the Foo class.

6 0
3 years ago
The system where the unit of measurement is centimeter
aleksklad [387]

Answer:

International System of Units

Explanation:

3 0
3 years ago
Which statement accurately describes DTP programs?
s2008m [1.1K]

Answer:

O DTP programs are basically layout programs.

Explanation:

Desktop publishers are vector-based graphics software, and a perfect example of one such software is Microsoft Publisher. You can consider Adobe Illustrator, and Corel Draw as well, but they are huge software meant for many more things, and hence let's include only Microsoft publisher. And a long list follows as well. And they are in general a layout program used to prepare cards, advertisements, infographics, etc, and in fact the layout for them. And hence its more appropriate to say that it is basically a layout program that uses vector graphics to accomplish its goal. Various formats supported are like SVG, EPS, PDF,AI etc. And these are vector graphics based formats. The other type is Raster, and that includes Photoshop etc, with formats iike jpeg, gif etc, and which are pixel based.

7 0
3 years ago
When talking about the physical elements of the internet, the term redundancy refers to:?
Sphinxa [80]
It refers to the physical elements of the internet
6 0
3 years ago
Hello everyone. I need help. C programming. Create at least two more functions except the main () function to collect them.
Andrew [12]

Answer:

Explanation:

#include <iostream>

using namespace std;

int costdays(int);

int costhrs(int,int);

int main()

{

   int dd,hh,mm,tmph,tmpd,tmpm=0;

   int pcost,mcost=0;

   cout<<"Enter Parking time" << endl;

   cout<<"Hours: ";

   cin>>hh;

   cout<<"Minutes: ";

   cin>>mm;

   

   if (mm>60)

   {

       tmph=mm/60;

       hh+=tmph;

       mm-=(tmph*60);

   }

   if (hh>24)

   {

       tmpd=hh/24;

       dd+=tmpd;

       hh-=(tmpd*24);

   }

   if ((hh>4)&&(mm>0))

   {

       pcost+=costdays(1);

   }

   else

   {

       mcost=costhrs(hh,mm);

   }

   cout<<"Total time: ";

   if (dd>0)

   {

       cout<<dd<<"days ";

       pcost+=costdays(dd);

   }

   pcost+=mcost;

   cout<<hh<<"h "<<mm<<"mins"<<endl;

   cout<<"Total Cost :"<<pcost<<"Won";

   return 0;

}

int costdays(int dd)

{

   return(dd*25000);

}

int costhrs(int hh,int mm)

{

   int tmpm, tmp=0;

   tmp=(hh*6)*1000;

   tmp+=(mm/10)*1000;

   tmpm=mm-((mm/10)*10);

   if (tmpm>0)

   {

       tmp+=1000;

   }

   return(tmp);

}

3 0
3 years ago
Other questions:
  • Describe in 2–3 sentences how you would use the autosum shortcut.
    9·2 answers
  • Which practice represents the trait of effective communication?
    6·2 answers
  • You would like to search for information about storms but not tornadoes. What type of search strategy may be useful?
    10·2 answers
  • Technician A says that S-cams can be left or right handed. Technician B says that S-cam foundation brakes can have one or two an
    15·1 answer
  • Why is the cyber community important???
    8·2 answers
  • Which of the following that can be use to access session variables in PHP?
    14·1 answer
  • Which programming element is used by a game program to track and display score information?
    10·2 answers
  • Write an application named Perfect that displays every perfect number from 1 through 10,000. A number is perfect if it equals th
    5·1 answer
  • 5.7 AP-Style MC Practice edhessive
    14·1 answer
  • Glenda is searching airline schedules on HolApp, a mobile Web application. While browsing the application, a banner appears on t
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!