67 257
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #58831 in Java | JSP | JSF for Lekorius Wallace

Question #58831
Design a program that has five definitions of the method dataOut, with each one having a different signature. The signature for the five method definitions are
char, String, int, double
String, int, double, char
int, double
char, int
Expert's answer
public class PrintData {

public void dataOut(char letter, String name, int number, double value) {
System.out.println(letter + " " + name + " " + number + " " + value);
}

public void dataOut(String name, int number, double value, char letter) {
System.out.println(name + " " + number + " " + value + " " + letter);
}

public void dataOut(int number, double value) {
System.out.println(number + " " + value);
}

public void dataOut(char letter, int number) {
System.out.println(letter + " " + number);
}

public void dataOut(char letter, String name) {
System.out.println(letter + " " + name);
}

public static void main(String[] args) {

char letter = 'a';
String name = "Hello";
int number = 5;
double value = 6.25;

PrintData printData = new PrintData();
printData.dataOut(letter, name, number, value);
printData.dataOut(name, number, value, letter);
printData.dataOut(number, value);
printData.dataOut(letter, name);
printData.dataOut(letter, number);
}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions