Modify the method you wrote for
Want to see the full answer?
Check out a sample textbook solutionChapter 9 Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Introduction To Programming Using Visual Basic (11th Edition)
Introduction to Programming Using Visual Basic (10th Edition)
Problem Solving with C++ (10th Edition)
- This method will return a string that when printed out will display a triangle. Each row of the triangle will have the next letter from the input argument as the last letter in the row. If the next letter is the noPrint char, * will print out instead of letters for the row. Can’t cannot use System.out.println to print the calculated result in the method. You return itarrow_forwardWrite the java code body of the method countPunctuations. The method will return the number of punctuation marks in a sentence of phrase. Test Result System.out.println("Number of punctuation marks: "+countPunctuations("Help! Help! This is an emergency.")); Number of punctuation marks: 3 int countPunctuations(String str){ //your code}arrow_forwardMethod called reverse that reverses a string passed to this method as a parameter and returns the reversed string. Eg reverse(“string”) should return “gnirts”. Print out the reversed string in your main method. Hint: Use CharAt or Substring methods from the String Class.arrow_forward
- This method will return a string that when printed out will display a triangle. Each row of the triangle will have the next letter from the input argument as the last letter in the row. If the next letter is the noPrint char, * will print out instead of letters for the row. Can’t use System.out.println to print the calculated result in the method. You return itarrow_forwardWrite a void method which will print out a sentence “Hello World!”. Call the method from main().arrow_forwardProgram62.javaWrite a program that prompts for a full name (first and last) and assigns it to one string. The program then passes the full name to a void method as its sole parameter. The void method should print the first name, on one line, as many times as indicated by the length of the last name. Sample Output (image below)arrow_forward
- True or False? Arrays cannot be passed as parameters, but must be used only in the main method.arrow_forwardJava Your program will read in a credit card number and expiration date from the user and validate the data. The program will continue to ask for user input until a valid number and date are entered. The rules for what is valid are specified below. readYear() and readMonth(int) methods Complete the readYear() and readMonth(int) methods. These methods ask the user to input the expiration year and month of their credit card. Each method should contain a loop inside the method so the code repeats until a valid month or year is entered by the user. If the user enters an invalid year or month, print an error message and ask them to try again. The readMonth(int) method reads in the month as a number. A valid month is any number between 1 and 12 (inclusive). A valid year is 2022 or later. readCreditCardNumber() method Complete the readCreditCardNumber() method. This method asks the user to input their credit card number. This method should contain a loop so the code repeats until a valid…arrow_forwardT/F Java methods can return more than one item if they are modified with the reserved word continue, as in public continue int foo() {...}arrow_forward
- * Celsius Temperature Table - prog 6 pg 291 * formula for fahrenheit to celsius is c = 5/9(f-32) * Write a method named celsius that takes a fahrenheit temp as an argument. * The method should return the temp converted to celsius. * Demonstrate this method by using it in a loop that displays a table of fahrenheit temps 0-20 and the celsius conversions. Without using the decimal formatarrow_forwardWrite a method called upper that takes a lowercase character as a parameter and converts the character to uppercase and returns it without using String’s toUpperCase() method. public char upper(char lowerChar){ Question 26 options:arrow_forwardPlease do not use string methods except to find methodarrow_forward
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT