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
Imagery functions as a coding system to help individuals acquire movement patterns. this describes
denis-greek [22]

Answer:

Imagery can be used to develop qualities in yourself you'd like to have — it's like emotional body-building — and using a technique called “Evocative Imagery” you can cultivate courage, patience, tolerance, humor, concentration, self-confidence or any other quality you'd like to embody.

3 0
3 years ago
A technician is troubleshooting an employee laptop that has a wired network connectivity issue. The laptop can connect to the in
defon

By Tx/Rx reverse the technician can address this issue.

C. Tx/Rx reverse

<u>Explanation:</u>

Technician has to trouble the laptop, since the laptop is connected and got internet while is the network resources inside the office. But if he connects the same laptop in research lab end user is not connected

Following troubleshooting to made

1. Routing is done properly

2. Any packet dropping by using TRACE command in windows operating system.

Since DHCP is used in office, whereas same type is not used in research lab. End user can try TX/RX reverse cable to connect in the research laptop.

5 0
4 years ago
Which of the follow is the best technique to determine how many menu items are needed and how to structure the menus and sub men
AnnZ [28]

Answer:

c. ​Group use cases by actor.

Explanation:

A use case is used to describe interaction between systems and users to achieve a goal. Mostly, a list of possible interaction between the system and the user is identified. The user can be a single person or a group. By using use case, the requirement of a systems is identified from a users point of view.

8 0
3 years ago
What operating system is a smartphone most likely to use?<br> a. bsdb. mac os xc. symbiand. linux
Deffense [45]
Linux based operating system is the norm. but android used linux based kernal and so did microsoft on thier phones and so on any low end operating system their based on linux.
Which version of linux?
well their are variety which the dev can choose
5 0
3 years ago
Which attribute allows you to create a hyperlink?<br> need answer now
igomit [66]

Answer:

the href attribute

Explanation:

3 0
2 years ago
Other questions:
  • How can u refer to additional information while giving a presentation
    15·1 answer
  • Assume the existence of a Window class with a function getWidth that returns the width of the window. Define a derived class Win
    15·1 answer
  • Method x1() has code that calls method x2(). Method x2() has the following header.
    7·1 answer
  • Universal Containers is tracking the interviewer's ratings of candidate in Salesforce. They would like to easily link the Candid
    9·1 answer
  • Aapke question about computer keyboard​
    5·1 answer
  • Give an example of a situation in which a compromise of Confidentiality leads to compromise in Integrity.Situation where confide
    8·1 answer
  • mta software development fundamentals You are creating an application that accepts input and displays a response to the user. Yo
    10·1 answer
  • 2. The Warren Commission investigated the assassination of President _______________________ in 1964.
    6·1 answer
  • Who is the best Attack on Titan Character?
    12·2 answers
  • Where else can the computer send the results of processing other than to output​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!