subject

Within the the Assignment05.java file, you must define the following static methods. In the main method, you may program any code that wish to test the methods you have been asked to define. 1) Write (define) a static method named displayGreeting, that takes no arguments and returns no value. When this function is called, it should print the text "Hello, and welcome!".
Example:
displayGreeting() will print Hello, and welcome!
2) Write (define) a static method named displayText, that takes a single String argument and returns no value. When this function is called, it should print the value of the argument that was passed to it.
Examples:
displayText("Hello") will print Hello
displayText("123") will print 123
displayText("abc" + "123") will print abc123
3) Write (define) a static method named printTotal, that takes three int arguments. When this function is called, it should print the sum of the three arguments passed to it. This function should return no value.
Examples:
printTotal(0, 0, 0) will print 0
printTotal(0, 1, 3) will print 4
printTotal(100, 23, 2) will print 125
4) Write (define) a static method named getTotal, that takes three int arguments. When this function is called, it should return the sum of the three arguments passed to it as an int.
Examples:
getTotal(0, 0, 0) will return 0
getTotal(0, 1, 3) will return 4
getTotal(100, 23, 2) will return 125
5) Write (define) a static method named getAverage, that takes three int arguments. When this function is called, it should return the average of the three arguments passed to it as a double.
Examples:
getAverage(0, 0, 0) will return 0.0
getAverage(0, 1, 3) will return 1.33333...
getAverage(100, 13, 7) will return 40.0
6) Write (define) a static method named averageLength, that takes three String arguments. When this function is called, it should return the average length (number of characters) of the String arguments passed to it as a double.
Examples:
averageLength("a", "abc", "ab") will return 2.0
averageLength("hello", "goodbye", "monday") will return 6.0
averageLength("wednesday", "tuesday", "monday") will return 7.33
7) Write (define) a static method named lengthOfShortest, that takes two String arguments. When this function is called, it should return the length (number of characters) of the shortest String argument passed to it as an int.
Examples:
lengthOfShortest("abc", "ab") will return 2
lengthOfShortest("hello", "goodbye") will return 5
lengthOfShortest("thursday", "friday") will return 6
8) Write (define) a static method named stringOfStars, that takes one String argument. When this function is called, it should return a String of asterisks (*) that is the same length as the string argument passed to it.
Examples:
stringOfStars("abc") will return "***"
stringOfStars("Hello, world!") will return ""
stringOfStars("0123456789") will return ""
9) Write (define) a static method named maxStringOfStars, that takes two String arguments. When this function is called, it should return a String of asterisks (*) that is the same length as the longest string argument passed to it.
Examples:
maxStringOfStars("a", "abc") will return "***"
maxStringOfStars("hello", "goodbye") will return ""
maxStringOfStars("thursday", "friday") will return ""
10) Write (define) a static method named midStringOfStars, that takes three String arguments. When this function is called, it should return a String of asterisks (*) that is the same length as the string argument with the length that would be in the middle if the lengths of the arguments were arranged in ascending order.
Examples:
midStringOfStars("a", "abc", "ab") will return "**"
midStringOfStars("hello", "goodbye", "yes") will return ""
midStringOfStars("123456", "12", "1234") will return ""

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
Which of the following processes applications across multiple computing devices? a. functional application b. distributed system c. workgroup information silo d. information silo
Answers: 3
question
Computers and Technology, 25.06.2019 01:30
What controls can be found on the file tab of microsoft word
Answers: 1
question
Computers and Technology, 25.06.2019 04:30
Which relativos possible when two tables share the same primary key? a.) one-to-one b.) one-to-many c.) many-to-one d.) many-to-many
Answers: 2
You know the right answer?
Within the the Assignment05.java file, you must define the following static methods. In the main met...
Questions
question
English, 22.07.2019 03:50
question
Spanish, 22.07.2019 03:50
Questions on the website: 13722367