For each part, code a static method as described and test it by calling it from...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
For each part, code a static method as described and test it by calling it from main and printing the result (all of the methods should be static in order to be accessible from main) Write a method named calc which takes two int arguments (x and y), then calculates the following a. formula and returns the result. Use the Scanner to input the integers from the user and the output should be rounded to two decimal places: /лу? 2х b. Write a method named wordCap which takes a string argument and returns its capitalized form. For example wordCap ("HEILO") returns Hello. c. Write a method named findKeyWord which takes two inputs, a string (str) and a key word (kw), and returns true if it finds kw in str. * Challenge: Add a third parameter, a flag, which if it's true, the searching should be case insensitive. This lab is due at the beginning of your next regular lab period. Show all your work and documented code to your lab instructor to receive a mark during the lab. Make sure you sign the attendance sheet. Lab marks (2 pts = completed fully; 1 pt = some errors; 0 pt = no work demonstrated; 1 mark for attendance]. Undocumented code will not be graded. Every method must be documented with three pieces of information as such: Description of the method use javadoc tags, always placing the doc just before the method Input: what are the parameters, assumptions for input Output: what does this method do? Print? Return? Change?... For each part, code a static method as described and test it by calling it from main and printing the result (all of the methods should be static in order to be accessible from main) Write a method named calc which takes two int arguments (x and y), then calculates the following a. formula and returns the result. Use the Scanner to input the integers from the user and the output should be rounded to two decimal places: /лу? 2х b. Write a method named wordCap which takes a string argument and returns its capitalized form. For example wordCap ("HEILO") returns Hello. c. Write a method named findKeyWord which takes two inputs, a string (str) and a key word (kw), and returns true if it finds kw in str. * Challenge: Add a third parameter, a flag, which if it's true, the searching should be case insensitive. This lab is due at the beginning of your next regular lab period. Show all your work and documented code to your lab instructor to receive a mark during the lab. Make sure you sign the attendance sheet. Lab marks (2 pts = completed fully; 1 pt = some errors; 0 pt = no work demonstrated; 1 mark for attendance]. Undocumented code will not be graded. Every method must be documented with three pieces of information as such: Description of the method use javadoc tags, always placing the doc just before the method Input: what are the parameters, assumptions for input Output: what does this method do? Print? Return? Change?...
Expert Answer:
Answer rating: 100% (QA)
To generate java doc in eclipse IDE Go to Projects Generate JavaDoc Function class containing all static functions package myPackage import javatextDecimalFormat import javamathRoundingMode Function c... View the full answer
Related Book For
Applying International Financial Reporting Standards
ISBN: 978-0730302124
3rd edition
Authors: Keith Alfredson, Ken Leo, Ruth Picker, Paul Pacter, Jennie Radford Victoria Wise
Posted Date:
Students also viewed these programming questions
-
The x distribution must be normal in order to use a chi-square distribution to test the variance. What are some methods you can use to assess whether the x distribution is normal?
-
In what circumstances must assumptions be made in order to assign a cost to inventory items when they are sold?
-
The price p that must be set in order to sell q items is given by the equation p = -3q + 1200. (a) Find and interpret the p-intercept of the graph of the equation. (b) Find and interpret the...
-
Read the article Problem at INSPEECH and answer the question: Why did Inspeech experience a meltdown in 1988?
-
On January 1, 2018, White Water issues $600,000 of 7% bonds, due in 10 years, with interest payable annually on December 31 each year. Required: Assuming the market interest rate on the issue date is...
-
Which is NOT a question managers should ask when assessing whether or not a course of action is ethical? a. Will I get caught? b. Would I publicize my action? c. Am I being honest? d. Is it legal?
-
Identify the four components of an ecosystem. After you do this try to visualize the interactions of these four components of an ecosystem as illustrated by Figure 2. 2 in the textbook. Does this...
-
Lenni Clothing Co. manufactures clothing in a small manufacturing facility. Manufacturing has 25 employees. Each employee presently provides 40 hours of productive labor per week. Information about a...
-
What are the key components of a relational database management system? Why are relational database management systems different from database models that preceded the relational model?
-
There are both pragmatic and normative arguments for citizen engagement in spatial planning. Pragmatic arguments include the need to address increasingly wicked problems - utilizing the knowledge of...
-
During the risk response phase, _______. a.analytical procedures can be used, and are required, as a substantive test to gather audit evidence b.all analytical procedures have been conducted...
-
What is the link between greenhouse gas emissions and growth? What is the expected effect on growth from emissions reduction? Why is international burden sharing of greenhouse gas emissions reduction...
-
Mary is a newly licensed pharmacist hired to work at a small independent pharmacy in town. On her first weekend at work as a pharmacist, she is instructed by the owner to complete a controlled...
-
Using the state pharmacy laws and rules from your state, how does your state regulate hospital pharmacies? What are some main differences between the state regulations covering community pharmacy...
-
Lim is a new pharmacist heavily in debt. A couple of Lims patients at the pharmacy who regularly received prescriptions for controlled substances told Lim they could make it worth his while if he...
-
Using the state pharmacy laws and rules from your state, does your state have any drug repository or take-back programs? If yes, describe the details.
-
[10 01 (a) if the matrix A = 1-10 satisfies A = 1, then find the elements of a 1-2 1 square matrix B that satisfies BA=0 21 1 4 31 [10 marks] -1 0 0 (b) Find the composite transformation matrix that...
-
Write a program to move a signed number from smaller register to bigger register. Hint: movzx ax, bl Topic: Data Related Operators and Directives in assembly language
-
In tax-effect accounting, creation of temporary differences between the carrying amount and the tax base for assets and liabilities leads to the establishment of deferred tax assets and liabilities...
-
'Estimating the value of inventory is not sufficiently accurate to justify using such an approach. Only a full physical count can give full accuracy.' Discuss.
-
Given that there is no guarantee that the bank will always support Japan Ltd, particularly if there is a potential for economic loss, discuss whether Japan Ltd is a parent of Maldives Ltd. JAPAN...
-
What is the half-life of uranium-238?
-
Who discovered that energy and mass are two different forms of the same thing?
-
Is it possible for a hydrogen nucleus to emit an alpha particle? Why? (a) yes, because alpha particles are the simplest form of radiation (b) no, because it would require the nuclear fission of...
Study smarter with the SolutionInn App