Solution: https://www.techmesto.com/fix-start-menu-broken-windows-10-technical-preview/
Or run this in power shell
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage
-DisableDevelopmentMode
-Register "$($_.InstallLocation)\AppXManifest.xml"}
Challenge 238 Easy consonants and vowels
package com.company;
import java.util.Random;
import java.util.regex.*;
public class Main {
public static void main(String[] args) {
String inputString = "CVcvcvcc";
char[] consonants = "bcdfghjklmnpqrstvwxyz".toCharArray();
char[] vowels = "aeiou".toCharArray();
Random random = new Random();
Pattern pattern = Pattern.compile("[^vcVC]");
Matcher matcher = pattern.matcher(inputString);
if (matcher.find()) {
System.out.println("Invalid character in input");
} else {
StringBuilder output =
new StringBuilder(inputString.length());
for (char letter : inputString.toCharArray()) {
switch (letter) {
case 'c':
output.append(consonants[random.nextInt
(consonants.length)]);
break;
case 'C':
output.append(Character.toUpperCase
(consonants[random.nextInt(consonants.length)]));
break;
case 'V':
output.append(Character.toUpperCase
(vowels[random.nextInt(vowels.length)]));
break;
case 'v':
output.append(vowels[random.nextInt
(vowels.length)]);
break;
}
}
System.out.println(output);
}
}
}
Originally did this with multiple ifs' and it looked bloody awful.
No comments:
Post a Comment