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
Vinil7 [7]
3 years ago
9

Write a Java program that takes as input a paragraph as a String and identifies if any of the words in the paragraph is a $1.00

word. The value of each word is calculated by adding up the value of each one of its characters. Each letter in the alphabet is worth its position in pennies i.e. a
Computers and Technology
1 answer:
Verizon [17]3 years ago
4 0

Answer:

In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

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

 String para = input.nextLine();

 String[] para_words = para.split("\\s+");

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

     para_words[i] = para_words[i].replaceAll("[^\\w]", "");

     char[] eachword  = para_words[i].toCharArray();

     int penny = 0;

     for(char c : eachword){

         int value = (int)c;

         if(value<=122 && value>=97){   penny+=value-96;     }

         else if(value<=90 & value>=65){  penny+=value-64;  }

     }

     if(penny == 100){

         System.out.println(para_words[i]);

     }

       penny = 0;

}

}

}

Explanation:

<em>Due to the length of the explanation, I've added the explanation as an attachment</em>

Download txt
You might be interested in
An algorithm whose worst-case time complexity is bounded above by a polynomial function of its size is called a(n)
Sedaia [141]

Answer:

polynomial-bounded algorithms

Explanation:

There are two algorithm complexities and they are time and space complexities. They can be denoted with the big-O notation. The big-o notation for a time and space complexity gets the worst-case time and space respectively.

The time complexity gets the measure of the execution time of an algorithm. When the time function is a polynomial ( k^n + k^n-1 ...) then the algorithm is said to be a polynomial-bounded algorithm.

4 0
3 years ago
What is a program that, when installed on a computer, records every keystroke and mouse click?
Mrac [35]
"Key logger" This could be software or hardware that does this.
6 0
3 years ago
Write the code to create a variable score and assign it the value 0?​
Galina-37 [17]

Answer:

You can assign a value to a routine variable in any of the following ways:

Use a LET statement.

Use a SELECT INTO statement.

Use a CALL statement with a procedure that has a RETURNING clause.

Use an EXECUTE PROCEDURE INTO or EXECUTE FUNCTION INTO statement.

Explanation:

4 0
3 years ago
What happens when you press Ctrl Alt Delete twice?
Iteru [2.4K]
The same thing as if you do it once
6 0
3 years ago
One subtask in the game is to roll the dice. explain why is roll the dice an abstraction.
LUCKY_DIMON [66]

Answer:

A game is built from a combination of sub-tasks in order to provide the best experience to the user and make sure that the interface is comprises of only the results of the ongoing sub-tasks to provide a higher degree of data abstraction.

Data abstraction refers to the process of representing the essential information without including the background details. Rolling a dice is preferred to be a sub-task so that the user only gets to know about the result of the roll and does not have to wait for or anticipate the result. Moreover, a game may consist of n number of sub-tasks so it is not a good idea to include them in the main framework and are preferred to be abstracted.

4 0
3 years ago
Other questions:
  • 3. Which of the following statements is true of a time management plan? 35 POINTS
    9·2 answers
  • Why is Abraham called the Father of Believers?
    6·1 answer
  • 4-One possible performance multiplication enhancement is to do a shift and add instead of an actual multiplication. Since 9 * 6,
    12·1 answer
  • Select a cybersecurity career that interests you. Describe the job duties and identify the skills required to excel in that care
    15·1 answer
  • Anyone else like hunter x hunter?<br> lets talk abt it uwu<br><br> good day :)
    14·2 answers
  • Need answer ASAP
    14·1 answer
  • Difference between switch and switch lite
    10·1 answer
  • Find the mean median mode and range of the data set <br> 11, 13,11,12 10 ,12,11,8
    10·1 answer
  • How do i unblock a website on a school computer if a school blocks it?
    5·1 answer
  • rue or false: The first web browser was introduced to the public in the 1970s and started the explosive growth of the Internet i
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!