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
telo118 [61]
3 years ago
15

. Write a short program that asks the user to input a string, and then outputs the

Computers and Technology
1 answer:
Mice21 [21]3 years ago
7 0

Answer:

// program in java.

// package

import java.util.*;

// class definition

class Main

{

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // object to read input from user

Scanner scr=new Scanner(System.in);

System.out.print("Enter a string:");

 // read input

String myString=scr.nextLine();

 // variable to store characters count

int char_count=0;

 // count the characters

for(int i = 0; i < myString.length(); i++) {

           if(myString.charAt(i) != ' ')

               char_count++;

       }

       // print the number of character

System.out.println("total characters in the String: "+char_count);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read a string from user with the help of Scanner object and assign it to variable "myString".Iterate over the string and if character is not space (' ') then char_count++. After the loop print the number of characters in the string.

Output:

Enter a string:hello world

total characters in the String: 10

You might be interested in
What is an activity that can help you enhance the appearance of your computer’s desktop?
aleksandrvk [35]
Depending on your computer, but going to control panel on a Windows computer can change the brightness, and backgrounds. 
5 0
3 years ago
Read 2 more answers
How should work be allocated to the team in a Scrum project?
Mkey [24]

Answer:

In a Scrum project, the work or the tasks are not allotted specifically. The Scrum Master is not allowed to assign tasks to the team members under any circumstance. Once the client provides the details regarding their requirements in detail, the tasks are distributed based on the expertise and skills of the employee.

Explanation:

4 0
3 years ago
Inserting and deleting text is a basic editing task in word processing.<br><br> True or false
Katyanochek1 [597]
The answer should be true
3 0
3 years ago
Read 2 more answers
Remember for a moment a recent trip you have made to the grocery store to pick up a few items. What pieces of data did the Point
Umnica [9.8K]

Answer:

Data: Data are raw facts and figures that are collected together for analysis. In other words, Simple no processing is data.

Information: Information is the facts provided about something. In simple terms, processed data is information.

Knowledge: Knowledge is the processed facts that are understand for a conclusion.

1. An item's UPC number - data

Explanation: An item number is data because simple no processing is required.

2. Change back to customer - information

Explanation: Data about a customer is information.

3. General changes to demand in different seasons - knowledge

Explanation: Requires data (time and quantity purchased) to be processed/aggregated into information. The information is understood to provide a pattern of demad changes due to seasons.

4. Cost each - data

Explanation: Cost each is data because simple no processing is required.

5. Quantity purchased - data

Explanation: Cost each is data because simple no processing is required.

6. Non-taxable total - information

Explanation: -- requires that data (prices, amounts and whether the item is taxable) to be processed (price * amount for items that are non-taxable).

7. Extended cost [quantity times cost each] - information

Explanation: Extended cost requires processing two pieces of data quantity and cost

8. Amount tendered - data

Explanation: Amount tendered is data because simple no processing is required.

9. Sales of an item for the last week - information

Explanation: Sales of an item for the last week requires aggregating sales for a specific time frame together

10. Upcoming holidays and customer's special needs - knowledge

Explanation: Upcoming holidays and customer's special needs requires holiday data (dates) to be combined with information gathered about customer to understand customer's special needs

11. How paid [cash, charge card, debit card] - data

Explanation: Cost each is data because simple no processing is required.

12. Shopper loyalty card number - data

Explanation: Cost each is data because simple no processing is required.

13. Taxable total - information

Explanation: Taxable total requires that data (prices, amounts and whether the item is taxable) to be processed (price * amount for items that are taxable).

Explanation:

6 0
3 years ago
Explain the basic method for implementing paging.
iogann1982 [59]

Answer:

The answer is below

Explanation:

In order to carry out the basic method for implementing paging, the following processes are involved:

1. Both physical and logical memories are broken into predetermined sizes of blocks otherwise known as FRAMES and PAGES respectively

2. During processing, Pages are loaded into the accessible free memory frames from the backing store. The backing store is however compartmentalized into predetermined sizes of blocks whose size is equal to the size of the memory frames

8 0
3 years ago
Other questions:
  • What is a function library?
    11·1 answer
  • Casting is one of the oldest known manufacturing processes. <br> True or false
    6·2 answers
  • What do you click to create a new presentation in noral view
    12·1 answer
  • Which program can damage your computer
    13·2 answers
  • . Does Zuckerberg believe in the thought that “the endpoint is when you sell the
    15·1 answer
  • ______ is a type of computer software that is installed into devices such as printers, print servers, and various types of commu
    5·1 answer
  • I have a question. This question will probably be deleted, but why do moderators keep deleting my answers when they are legitima
    13·1 answer
  • What dd command would you use to copy the contents of a partition named /dev/drive1 to another partition, called /dev/backup?
    6·1 answer
  • Update thejavafile names to include your initials at the end, send .java file only.1. Completein-place heapSort, which takes an
    11·1 answer
  • What is the digital revolution and how did it change society?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!