1.  Complete the second printSalutation() method to print the following given personName \"Holly\" and customSalutation \"Welcome\": Welcome, Holly End with...

80.2K

Verified Solution

Question

Programming

1.  Complete the second printSalutation() method toprint the following given personName \"Holly\" and customSalutation\"Welcome\":

Welcome, Holly

End with a newline.

What I am given:

import java.util.Scanner;

public class MultipleSalutations {
public static void printSalutation(String personName) {
System.out.println(\"Hello, \" + personName);
}

//Define void printSalutation(String personName, StringcustomSalutation)...

/* Your solution goes here */

public static void main (String [] args) {
printSalutation(\"Holly\", \"Welcome\");
printSalutation(\"Sanjiv\");
}
}

2. Write a second convertToInches() with two double parameters,numFeet and numInches, that returns the total number of inches. Ex:convertToInches(4.0, 6.0) returns 54.0 (from 4.0 * 12 + 6.0).

What I am given:

import java.util.Scanner;

public class FunctionOverloadToInches {

public static double convertToInches(double numFeet) {
return numFeet * 12.0;
}

/* Your solution goes here */

public static void main (String [] args) {
double totInches;

totInches = convertToInches(4.0, 6.0);
System.out.println(\"4.0, 6.0 yields \" + totInches);

totInches = convertToInches(5.8);
System.out.println(\"5.8 yields \" + totInches);
}
}

Answer & Explanation Solved by verified expert
4.3 Ratings (694 Votes)
1 public class MultipleSalutations public static void printSalutationString personName SystemoutprintlnHello personName public static void    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students