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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 13:20, hanhann6895
Arectangular room is 4 meters longer than it is wide and its preimeter is 32 meters find the dimensions of the room
Answers: 3
image
Computers and Technology, 22.06.2019 18:30, emojigirl2824
Word vocabulary words: print, proofread, status line, graphics, font effects, left margin, justification, line spacing, copy/paste, data. review words: font point, bold, save, center, error. fill in the correct word for the definition and then transfer the letters to the appropriate spot by number. some numbers will be found multiple times. you will end up with a quotation about…… what else? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 k 16 17 18 19 20 21 22 23 24 25 8 27 28 29 w 31 32 k 34 35 36 w h 39 40 41 42 8 44 45 46 47 48 49 50 51 52 53 54 55 .1. a software function that records keystrokes on a disk or drive so information can be 5 4 52 9 later retrieved. p n 2. to produce a paper copy of information. 10 7 12u n 3. a display that shows the location of the cursor, pages, etc. 45 46 18 27 36 20 42p4. pictures or images, located in clip art or other files. 6 24 44 28 34 49 555. any mis-stroke of a key. 47 41 48 2 10 n6. allows major changes to the font such as shadow, emboss, etc. 21 25 46 35 23 21 29 14 22 17 n7. a feature that centers lines of text horizontally. 49 53 46 9 51 p8. size of the font 31 16 22 b l 9. a feature that prints designated text darker than the rest to add emphasis. 32 3 . p10. to compare copy on a display screen or printout to the original 24 39 25 23 54 9 50 3 and correct errors. j un 11. a feature that allows text to be aligned at the left 11 12 7 21 16 49 40 46 34 2 and right margins. leftn 12. amount of blank space on the left side of the paper. 8 18 41 6 34 linen 13. number of blank lines between lines of text. 17 4 49 13 1914. any information inputted into the computer. 3 4 46 44 p /p15. feature that duplicates text from one location and places it in another.
Answers: 2
image
Computers and Technology, 24.06.2019 02:00, arubright177
Write an expression that will cause the following code to print "equal" if the value of sensorreading is "close enough" to targetvalue. otherwise, print "not equal". ex: if targetvalue is 0.3333 and sensorreading is (1.0/3.0), output is:
Answers: 1
image
Computers and Technology, 24.06.2019 08:00, Maxxboogie
Can someone work out the answer as it comes up in one of my computer science exams and i don't understand the cryptovariables
Answers: 1
You know the right answer?
Within the the Assignment05.java file, you must define the following static methods. In the main met...

Questions in other subjects:

Konu
History, 28.01.2020 19:09