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
ValentinkaMS [17]
3 years ago
5

(JAVA PLS)

Computers and Technology
1 answer:
Elza [17]3 years ago
6 0

import java.util.Scanner;

public class JavaApplication54 {

   public static int appearance(String word, char letter){

       int count = 0;

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

           if (word.charAt(i) == letter){

               count++;

           }

       }

       return count;

   }

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Type the message to be shortened");

       String message = scan.nextLine();

       message = message.toLowerCase();

       int volCount = 0, repCount = 0, num = 0;

       char prevC = ' ';

       String vowels = "aeiou";

       String newMessage = "";

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

           char c = message.charAt(i);

           

           if (vowels.indexOf(c) != -1 && prevC == ' '){

               newMessage += c;

           }

           else if (vowels.indexOf(c) == -1 && prevC != c){

               newMessage += c;

           }

           else if (vowels.indexOf(c) != -1){

               volCount ++;

           }

           else{

               repCount++;

           }

            prevC = c;

       }

       System.out.println("Algorithm 1");

       System.out.println("Vowels removed: "+volCount);

       System.out.println("Repeats removed: "+repCount);

       System.out.println("Algorithm 1 message: "+newMessage);

       System.out.println("Algorithm 1 characters saved: "+(message.length() - newMessage.length()));

       

       String uniqueMessage = "";

       

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

           char w = message.charAt(i);

           if (uniqueMessage.indexOf(w)== -1 && w!=' '){

               uniqueMessage += appearance(message,w)+""+w;

               num++;

           }

       }

       System.out.println("Algorithm 2");

       System.out.println("Unique characters found: "+num);

       System.out.println("Algorithm 2 message: "+uniqueMessage);

       System.out.println("Algorithm 2 characters saved: "+(message.length() - uniqueMessage.length()));

   }

   

}

I hope this helps!

You might be interested in
Add definitions for the following keywords to your glossary of words.
lianna [129]

Answer:

wifi=a facility allowing computers, smartphones, or other devices to connect to the internet or communicate with one another wirelessly within a particular area.

bandwidth=a range of frequencies within a given band, in particular that used for transmitting a signal.

The bit is the most basic unit of information in computing and digital communications. The name is a contraction of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented as either "1" or "0", but other representations such as true/false, yes/no, +/−, or on/off are commonly used.

A megabit is a unit of digital information with prefix mega (symbol M). And it is equal to one million bits. It also means 106 bits or 1,000,000 bits. ... The unit symbol of megabit is Mbit. You can convert megabit to other units of data using our tool.

The gigabit is a multiple of the unit bit for digital information or computer storage. ... 1 gigabit = 109bits = 1000000000bits. The gigabit has the unit symbol Gbit or Gb. Using the common byte size of 8 bits, 1 Gbit is equal to 125 megabytes (MB) or approximately 119 mebibytes (MiB).

The Emergency Broadband Benefit is an FCC program to help families and households struggling to afford internet. The Emergency Broadband Benefit is limited to one monthly service discount and one device discount per household.

Buffering is the process of preloading data into a reserved area of memory that's called a buffer. In the context of streaming video or audio, buffering is when the software downloads a certain amount of data before it begins playing the video or music.

5 0
3 years ago
What is smallpdf(app) for? How can I use it? ​
Fynjy0 [20]
Smallpdf app is. For windows
Go to your homepage and click a tool
Drag a file into the colored toolbox
Most tools should start working on the file right away
For some tools, further optimization options may be available
Download the converted doc to your local drive
O
)
O
8 0
3 years ago
Which statement describes a characteristic of SRAM in a PC?
svlad2 [7]

It is used for cache memory.

Further Explanation:

Cache memory is the memory that stores the instructions and data that is used repeatedly. If the processor wants some data it first looks into cache memory then the processor doesn't has to look into the main memory for the data or instructions which is more time consuming. As the SRAM uses small but a constant source of power, it is usually used for making cache memories. Moreover it is benficial to keep the previously used data in SRAM(Which is faster) than acessing DRAM (Which is way more slow than SRAM.

  • Learn more about RAM in brainly.com/question/10602589
  • brainly.com/question/5159824
  • brainly.com/question/6062548

#LearnwithBrainly

8 0
3 years ago
I show you what the computer has processed and you have to look at my screen to see what I have for you. What am I?
Tamiku [17]

Hey,

The answer to this is the monitor. This is the screen or screens that hook up to your pc most of them use the modern HDMI but there are other connecters like DVI,DisplayPort  and the old VGA.

Hope this helps have a great day

-scav

6 0
3 years ago
You are the senior nurse on the unit and you are orienting a new graduate LVN/LPN. One of the subjects you want to cover today i
dem82 [27]

Answer:

The correct answer to the following question will be Option D (Homans sign).

Explanation:

To medicine, the symptom of Homans is considered a sign of thrombosis by some physicians. John Homans described Homans as an annoyance under the knee of the foot to 1941 after forced dorsification.

  • Inspect the limbs for edema, pulse equality, and capillary refill.
  • Check to sign Homans.
  • Feel any warmth or redness along the Calf area.
  • Bilateral calves should be equal in size and warmth.
  • There must be no swollen, sore places, and when the woman is moving, there will be no pain in the calves.

Therefore, Option D is the right answer.

4 0
3 years ago
Other questions:
  • Whoevr answers this will be marked brainliest
    12·1 answer
  • What is the part of the computer system that receives inputs, directs those inputs to the processor, and redirects the processed
    14·1 answer
  • Plz help me of this answer<br><br><br>language:python​
    7·2 answers
  • If you filmed a clip in 120fps, how many frames are in a seconds of video.
    13·1 answer
  • _____ was just a sophomore when he began building computers in his dorm room at the University of Texas. His firm would one day
    14·1 answer
  • -..
    11·1 answer
  • You can have more that one image open at a time in GIMP. True or false
    10·1 answer
  • Write a program that prompts the user to enter a month (1-12) and year, then displays the number of days in the month. For examp
    9·1 answer
  • Consider the following incomplete code segment, which is intended to increase the value of each digit in a String by one. For ex
    9·1 answer
  • Using AI to filter potential job applicants might be considered _____
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!