Question: CSE110 Principles of Programming Assignment 05:100 pts Assignment 05 - Ten Methods You must work in alone on this assignment. Do not use any Java





CSE110 Principles of Programming Assignment 05:100 pts Assignment 05 - Ten Methods You must work in alone on this assignment. Do not use any Java language features we have not cover so far in this course. Assignment Objectives After completing this assignment the student should be able to: Write methods that have no parameters no return value Write methods that have parameters Write methods that have a return value . . Assignment Requirements For this assignment you are given the following files: Assignment05.java (you must complete this file) Problem Description and Given Info Within the Assignment05.java file, you must define the following static methods. In the main method, you may write any code that wish to test the methods you have been asked to define. You may also include any other methods that you wish to write as helper methods. 1) Write (define) a public static method named showGreeting, that takes no arguments and returns no value. When this method is called, it should print the text "Howdy, and welcome!". Example: showGreeting() will print Howdy, and welcome! Example: showGreeting() will print Howdy, and welcome! 2) Write (define) a public static method named displayMessage, that takes a single String argument and returns no value. When this method is called, it should print the value of the argument that was passed to it. Examples: display Message("Hello") displayMessage("123") displayMessage("abc" + "123") will print Hello will print 123 will print abc123 3) Write (define) a public static method named displayTotal, that takes four int arguments. When this method is called, it should print the sum of the arguments passed to it. This method should return no value. Examples: displayTotal(0, 0, 0, 0) displayTotal(0, 1, 3, 2) displayTotal(100, 23, 2, 1) will print 0 will print 6 will print 126 4) Write (define) a public static method named getSum, that takes three int arguments. When this method is called, it should return the sum of the arguments passed to it as an int. Examples: getSum(0,0,0) getSum(0, 1,3) getSum(100, 23, 2) will return 0 will return 4 will return 125 - 5) Write (define) a public static method named getMean, that takes four int arguments. When this method is called, it should return the average of the arguments passed to it as a double. Examples: getMean(0, 0, 0, 0) getMean(0,1,3,2) getMean(100, 13, 7,0) will return 0.0 will return 1.5 will return 30.0 6) Write (define) a public static method named totalLength, that takes three String arguments. When this method is called, it should return the total length (number of characters) of the String arguments passed to it as a double. Examples: totalLength("a", "abc", "ab") totalLength("hello", "goodbye", "monday") totalLength("wednesday", "tuesday", "monday") will return 6.0 will return 18.0 will return 22.0 7) Write (define) a public static method named length OfLongest, that takes two String arguments. When this method is called, it should return the length (number of characters) of the longest String argument passed to it as an int. Examples: lengthOfLongest("abc", "ab") length OfLongest("hello", "goodbye") length OfLongest("thursday", "friday") will return 3 will return 7 will return 8 8) Write (define) a public static method named stringOfStars, that takes one String argument. When this method is called, it should return a String of asterisks (*) that is the same length (number of characters) as the String argument passed to it. However, if the length of the String argument is less than 3, then the methods should return a String of 3 asterisks, and if the length of the String argument is greater than 10, then the methods should return a String of 10 asterisks. will return "*** Examples: stringOfStars("a") stringOfStars("Hello, world!") stringOfStars("012345") will return will return "******* 9) Write (define) a public static method named minStringOfStars, that takes two String arguments. When this method is called, it should return a String of asterisks (") that is the same length as the shortest String argument passed to it. Examples minStringOfStars("a", "abc") minStringOfStars("hello", "goodbye") minStringOfStars("thursday", "fridays") will return "*" will return "***". will return 10) Write (define) a public static method named minPlusMaxStringOfStars, that takes three String arguments. When P.Miller 10) Write (define) a public static method named minPlusMaxStringOfStars, that takes three String arguments. When P.Miller 2 CSE110 Principles of Programming Assignment 05::100 pts this method is called, it should return a String of asterisks (*) that is the same length as the length of the shortest String argument plus the length of the longest String argument. Examples: minPlusMaxStringOfStars("a", "abc", "ab") will return ***** minPlusMaxStringOfStars("hello", "goodbye", "yes") will return "*********** minPlusMaxStringOfStars("123456", "12", "1234") will return "********* Method Template Here is a template that you may use or refer to when defining your methods. All of your ten methods will follow this template; you must provide the components designated by the angle brackets () public static
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
