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!
b. helps you to prepare for a career in media.
c. enables you to be an intelligent consumer.
d. allows you to determine a product's quality.
b. AND decision
c. OR decision
d. logical decision
I think the answer is D
hopethishelpsyouout