PT Code For AP CS Exam
PT Code For AP CS Exam
updateScreen();
updateScreen2();
});
//Code From:https://studio.code.org/s/csp7-2020/stage/6/puzzle/3
//Sets the text on how many vowels were in the input
//Modified to work for my program
function updateScreen(){
var text = getText("wordinput");
var statement = vowel_count(text);
setText("text_area3","Number of Vowels: " + statement);
}
// Code From:https://studio.code.org/s/csp7-2020/stage/6/puzzle/3
//Sets the text area on how many nonvowels are in the input
//Modified to work with my program
function updateScreen2(){
var text = getText("wordinput");
var statement = nonvowel_count(text);
setText("text_area4","Number of NonVowels: " + statement);
}
//Citied:https://www.w3resource.com/javascript-exercises/javascript-function-exercise-7.php
//vowel and nonvowel counter
function vowel_count(str1)
{
var vowel_list = 'aeiouAEIOU';
var vcount = 0;
//Citied:https://www.w3resource.com/javascript-exercises/javascript-function-exercise-7.php
//Modified the previous code to count how many
//letters arent vowels and add to a counter to check
//Only checks for letters uppercase and lower,not numbers or symbols
function nonvowel_count(str1)
{
var nvowel_list = 'BCDFGHJKMNPQRSTVWXYZLbcdfghjkmnpqrstvwxyzl';
var nvcount = 0;