Question

In: Computer Science

write a statement to guarantee that the initial will be a capital letter. write the code...

write a statement to guarantee that the initial will be a capital letter.
write the code in jsGraph

Solutions

Expert Solution

Statement to check if inital letter will be a capital : string.charAt(0).toUpperCase()

JS Code that converts the inputted string's initial letter to capital :

<!DOCTYPE html> 
<html> 
        <head> 
                <title></title> 
        </head> 
                
        <body style = "text-align:left;"> 
        
                <h1 style = "color:black;" > 
                        Capital Initializer 
                </h1> 
                        
                <input id = "input" type="text" name="input"/> 
                <button onclick="Capital_Changer()"> 
                        Click to capitalize 
                </button> 
                <h3 id = "div" style="color: red"> 
                </h3> 
                        
                <script> 
                
                function Capital_Changer() { //Declaring function capital_changer
                var inp = document.getElementById("input");  //input variable
                var a = document.getElementById("div"); //returns value having id attribute
                var str = inp.value; 
                a.innerHTML = str.charAt(0).toUpperCase() +  //converting first letter to uppercase
                str.slice(1); 
                } 
                </script> 
        </body> 
</html>                                   

Code picture:

Output:

Summary : JS program that guarentees that the inputted string will start with capital letter. and I have also added the required statement at the beginning of the solution that guarentees the initial of a string to be a capital letter. This is all required by you in the question.

P.S. Hope you are satisfied with the provided solution, please give a thumbs up, Good Day !


Related Solutions

Using your language, write about the difference between the letter of credit and letter of guarantee...
Using your language, write about the difference between the letter of credit and letter of guarantee Word Limit for the assignment: Upper word limit: 1200 words Lower word limit: 600 words
Using your language, write about the difference between the letter of credit and letter of guarantee...
Using your language, write about the difference between the letter of credit and letter of guarantee Word Limit for the assignment: Upper word limit: 1200 words Lower word limit: 600 words
For the side-chains of the 20 amino acids. Write the 1-letter code and the 3-letter code...
For the side-chains of the 20 amino acids. Write the 1-letter code and the 3-letter code for each, in groups according to side-chain characteristics (eg. hydrophobic, polar with S or O containing functional groups, and polar with N containing functional groups).  For the amino acids listed, state whether the amino group, the acid group and the side-chain group will be significantly protonated, unprotonated or ~50% protonated at the following pH values: pH= 2.6, 4.8, 6.6, 7.4, 8.4, 9.2, 10.0. Also indicate...
Write Python code that checks if an existing variable letter is a lowercase vowel. If it...
Write Python code that checks if an existing variable letter is a lowercase vowel. If it is a, e, i, o, or u and print out "Yes, it is a lowercase vowel". If the letter is y, print out "The letter is a consonant". If the letter is anything else, print out "No, the letter is not a vowel". (language python)
Write a complain letter to a company that is known globally post as your initial response....
Write a complain letter to a company that is known globally post as your initial response. Your letter should clearly describe the problem, your attempts to solve the problem, and what adjustment or compensation you want. Pay attention to tone and to relationship – you are writing to a person and they may not be responsible for your problem.
Write a code to find the following in a text file (Letter). language: Python (a) Find...
Write a code to find the following in a text file (Letter). language: Python (a) Find the 20 most common words (b) How many unique words are used? (c) How many words are used at least 5 times? (d) Write the 200 most common words, and their counts, to a file. text file: Look in thy glass and tell the face thou viewest, Now is the time that face should form another, Whose fresh repair if now thou not renewest,...
code in python write a code where the initial value is compounded by a multiplier, rounded...
code in python write a code where the initial value is compounded by a multiplier, rounded to the nearest tenth Output: Initial Value: 10 Multiplier: 1.4 Number of compounds: 10 Your Values are: 10 , 14, 19.6 , 27.4, 38.4, 53.8, 75.3, 105.4, 147.6, 206.6
1. Write a Formal Letter: SOLICITED LETTER: Write a cover letter for an advertised job, or...
1. Write a Formal Letter: SOLICITED LETTER: Write a cover letter for an advertised job, or a job about which you have specific knowledge (perhaps a new opening at your current place of employment).
write a matlab code to find the following: initial position, initial velocity, and acceleration using the...
write a matlab code to find the following: initial position, initial velocity, and acceleration using the algorithm and information below time(seconds). height(m) velocity(m/s) 0. 0.2. 2.95 algorithm: 1. Enter data in to arrays. 2. Fit the height data to a 2nd order polynomial. 3. Evaluate the polynomial at enough points to get a smooth curve. 4. Find the velocity model by taking derivative of the height polynomial. 5. Evaluate the velocity polynomial at enough times to get a smooth curve
Problem 2(a). Letter Frequencies. ? Write Python code that reads a text file into memory and...
Problem 2(a). Letter Frequencies. ? Write Python code that reads a text file into memory and creates a dict object with a frequency count for each letter. For example, for encryptedA.txt, your output should contain the key:value pairs 'a': 78 and 'b': 31. Notes Do not distinguish between uppercase and lowercase letters. Ignore punctuation. Punctuation counts must not appear in your dict If a given letter does not appear in the text, there must be a key:value pair with value...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT