Write a program with a function adder (number1, number2) that takes two integers as parameters. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program with a function adder (number1, number2) that takes two integers as parameters. The function must sum the numbers and return the result. Call the function twice with arguments of your choice and print the results with an appropriate text. 2. Then ask the user to enter a text string, and then a letter. The program should then, using a loop, print out how many times the given letter occurs in the given text string. You should not consider uppercase and lowercase letters to be the same (for example, it would mean that there are 0 occurrences of "E" in the word "hey"). 3. Write a function countOccurrence (minText, minLetter). The function should count how many times a letter minLetter occurs in the text minText, and return this number. Then rewrite the lines of code from point 2 to use this function, but make sure that the program appears exactly the same to the user when it is run. Deliver the program as it looks after you have made this change (so you do not need to deliver two versions of the program). Write a program with a function adder (number1, number2) that takes two integers as parameters. The function must sum the numbers and return the result. Call the function twice with arguments of your choice and print the results with an appropriate text. 2. Then ask the user to enter a text string, and then a letter. The program should then, using a loop, print out how many times the given letter occurs in the given text string. You should not consider uppercase and lowercase letters to be the same (for example, it would mean that there are 0 occurrences of "E" in the word "hey"). 3. Write a function countOccurrence (minText, minLetter). The function should count how many times a letter minLetter occurs in the text minText, and return this number. Then rewrite the lines of code from point 2 to use this function, but make sure that the program appears exactly the same to the user when it is run. Deliver the program as it looks after you have made this change (so you do not need to deliver two versions of the program).
Expert Answer:
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
ACME produces Rocket Powered Skateboards for Wiley Coyote and friends. Direct materials cost $ 4 0 per unit, Direct labor cost $ 1 5 per unit, and factory overhead is applied based on direct labor...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
Write balanced equations based on the information given. (a) Solid magnesium + oxygen gas solid magnesium oxide (b) Nitrogen monoxide gas + oxygen gas nitrogen dioxide gas (c) Gaseous ethane(C2H6)...
-
Gears A and D are rigidly attached to horizontal shafts that are held by frictionless bearings. Determine (a) The couple 0 M that must be applied to shaft DEF to maintain equilibrium (b) The...
-
The 5-kg bar is released from rest while in the position shown and its end rollers travel in the vertical-plane slot shown. If the speed of roller A is 3.25 m/s as it passes point C, determine the...
-
The calculation of solar radiation impinging on a surface is of importance in many applications, for example, design of solar collectors, temperature control of buildings, etc. Your goal is to review...
-
The income statement accounts for the Monroe Realty Company at the end of its fiscal year are shown below. Prepare the required closing entries in journal form. Chris Ross is theowner. Account Name...
-
1. "Businesses are feeling the impact of the war in Ukraine. Risk managers update their risk profiles due to supply chain disruptions, economic sanctions, and even displaced workforce. These issues...
-
The Taos Museum of Southwestern Arts and Crafts (TMSAC) presents rotating exhibits of the works of artists and artisans from the Southwestern United States. Historically, the museum has derived its...
-
1. A ball with a mass of 10.0 g hits a 5.0 kg block of wood tied to a string, as shown. You may assume that there is no friction from the string. The ball hits the block in a completely inelastic...
-
A Radiation Technologist inherited a substantial sum of money from her grandfather. She wants to use the money to buy into a partnership that owns an imaging group. Is there anything that seems...
-
Provide some examples about the Human Resources management problem of Disneyland in China.
-
Apply the scientific method by developing a null and an alternative hypothesis that provides potential answers to the research question. What amount and intensity of exercise is likely to relieve...
-
low-ranking staff member who is on a first name basis with the Director/Executive Officer?)
-
In what ways doyousee adult learningprinciplesandemotional literacy enacted inyourown learning experiences (consider both formal and informal experiences and settings)?
-
Quiz A village has to farms having 10, 25.30, 17, 25, 30, 55, 40, 32 and 36 acres of Land under maize Plantation. It is desired to selecte a sample of size 4 with replacement and with probability...
-
A copper wire (density = 8.96 g/cm 3 ) has a diameter of 0.25 mm. If a sample of this copper wire has a mass of 22 g, how long is the wire?
-
Consider a class RatingScore that represents a numeric rating for something such as a movie. Its attributes are A description of what is being rated The maximum possible rating The rating It will...
-
Repeat the previous project, but position the centers of the circles on a spiral. The center of each circle will depend on both an angle and a distance from the origin. A constant change in both the...
-
Show the modifications needed to add exponentiation to the class Calculator in Listing 9.12. Use ^ to indicate the exponentiation operator and the method Math.pow to perform the computation. Listing...
-
solve the given problem using PSO method \[f(X)=1200\left(2 x_{1} x_{3}+2 x_{2} x_{3} ight)+2500 x_{1} x_{2}+500\left(\frac{1000}{x_{1} x_{2} x_{3}} ight)+100\left(\frac{1000}{10 x_{1} x_{2} x_{3}}...
-
Show 3 iterations for solving the problem below \[\min f(X)=-12 x_{1}-7 x_{2}+x_{2}^{2}\] subject to $-2 x_{1}^{4}-x_{2}+2=0$ \[0 \leq x_{1} \leq 3,0 \leq x_{2} \leq 3\]
-
Solve the optimization problem using SA \[\min f(X)=100\left(x_{1}^{2}+x_{2} ight)^{2}+\left(1-x_{1} ight)^{2}\] subject to $X \in[0,7]$
Study smarter with the SolutionInn App