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
A personal music database stores details of a personal music library, and can be used to manage your MP3, CD, or vinyl collectio
Rudiy27

Answer:

Check the explanation

Explanation:

Step 1: identify the entitles

From the statement given, the given entitles are artists, albums, tracks and played.

Step 2: identify the relationships

  1. One artist can make many albums
  2. One album can contain many tracks
  3. One track can be played many times.

Conversely, each play is associated with one track, a track is on one album, and an album is by one artist.

Step 3: identify the key attributes

The only strong entity in the database would be the “artist”, which has an attribute of artist ID so as to uniquely identifies it

Each album entity is uniquely identified by its album combined with the artist ID of the corresponding artist entity.

A track entity is similarly uniquely identified by its track ID combined with the related album ID and artist ID attributes.

The played entity is uniquely identified by a combination of its played time, and the related track ID attributes.

Step 4: identify other relevant attributes:

The attributes are straight forward; artist, albums, and track have names as well as identifiers to uniquely identify each entity. The track entity has a time attribute to solve the duration and the played entity has a timestamp to store when the track was played.

Step 5: Draw a complete ER diagram

The diagram explaining this question can be seen in the attached image below:

7 0
3 years ago
Select all that apply.
Nady [450]
1 and 2 since it says does not
5 0
3 years ago
Read 2 more answers
Pls help I will thx and give points
azamat

Answer:

Desktop

Explanation:

A tablet and smartphone dont have enough storage like a desktop, so they would edit very efficiently

5 0
2 years ago
Read 2 more answers
Write a statement that adds 1 to the variable reverseDrivers if the variable speed is less than 0,adds 1 to the variable parkedD
ch4aika [34]

Answer:

The c++ coding for this scenario is given below.

if( speed < 0 )

       reverseDrivers = reverseDrivers + 1;

   else if( speed >= 0 && speed < 1 )

       parkedDrivers = parkedDrivers + 1;

   else if( speed >= 1 && speed < 40 )

       slowDrivers = slowDrivers + 1;

   else if( speed >= 40 && speed <= 65 )

       safeDrivers = safeDrivers + 1;

   else

       speeders = speeders + 1;

Explanation:

First, five integer variables are declared and initialized.

int reverseDrivers = 0, parkedDrivers = 0, slowDrivers = 0, safeDrivers = 0, speeders = 0;

All the above variables need to be incremented by 1 based on the given condition, hence, these should have some original value.

Another variable speed of data type integer is declared.

int speed;

The variable speed is initialized to any value. User input is not taken for speed since it is not mentioned in the question.

Based on the value of the variable speed, one of the five variables, declared in the beginning, is incremented by 1.

The c++ program to implement the above scenario is as follows.

#include <iostream>

using namespace std;

int main() {

   int reverseDrivers = 0, parkedDrivers = 0, slowDrivers = 0, safeDrivers = 0, speeders = 0;

   int speed = 34;    

   if( speed < 0 )

   {

       reverseDrivers = reverseDrivers + 1;

       cout << " reverseDrivers " << endl;

   }

   else if( speed >= 0 && speed < 1 )

   {

       parkedDrivers = parkedDrivers + 1;

      cout << " parkedDrivers " << endl;

   }

   else if( speed >= 1 && speed < 40 )

   {

       slowDrivers = slowDrivers + 1;

      cout << " slowDrivers " << endl;

   }

   else if( speed >= 40 && speed <= 65 )

   {

       safeDrivers = safeDrivers + 1;

       cout << " safeDrivers " << endl;

   }

   else

   {

       speeders = speeders + 1;

       cout << " speeders " << endl;

   }    

return 0;

}

The program only outputs the variable which is incremented based on the value of the variable speed.

OUTPUT

slowDrivers

3 0
3 years ago
What is the procees called when deleting a hard drive securelly
zlopas [31]
The process of securely erasing a hard drive is called wiping :)
8 0
3 years ago
Other questions:
  • Which of the following is a true statement?
    8·1 answer
  • Where should a "deny all catch all" rule be positioned and why?<br> pleaseeee help!
    15·2 answers
  • Productivity can best be described as:
    5·2 answers
  • Define a class named ComparableSquare that extends Square (defined above) and implements Comparable. Implement the compareTo met
    7·1 answer
  • Assembly (Procedure and Conditional Processing). For the following program, what are outputs for register EAX, EBX, ECX, and EDX
    11·1 answer
  • Clarissa is a computer programming consultant. When a client states that they have an extremely complex programming task, which
    10·2 answers
  • Does anyone know the code for the beaded bracelet on codehs? pls i really need help
    8·1 answer
  • What is the output?
    12·1 answer
  • Do all the countries have the same date format?
    10·1 answer
  • Quickbooks online accountant firm users can use the quickbooks online advanced desktop app to access what types of client subscr
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!