Created
May 13, 2020 17:29
-
-
Save kryvoboker/672515ff53cf6772bd10b73ea6309b1b to your computer and use it in GitHub Desktop.
HomeWork6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
/** | |
* | |
* @author kamaz | |
*/ | |
public class Main { | |
public static void main(String [] args) { | |
int a = 0; | |
double b = 0; | |
String c = null; | |
System.out.println("Input number double"); | |
b = scannerDouble(b); | |
System.out.println("Input number int"); | |
a = scannerInt(a); | |
System.out.println("Input text"); | |
c = scannerString(c); | |
String d = getKon(c, a, b); | |
System.out.println(d); | |
} | |
public static int scannerInt(int a) { | |
Scanner sc = new Scanner(System.in); | |
int b = sc.nextInt(); | |
return b; | |
} | |
public static double scannerDouble(double a) { | |
Scanner sc = new Scanner(System.in); | |
double b = sc.nextDouble(); | |
return b; | |
} | |
public static String scannerString(String a) { | |
Scanner sc = new Scanner(System.in); | |
String b = sc.nextLine(); | |
return b; | |
} | |
public static String getKon(String a, int b, double c) { | |
double d = b; | |
double m = d + c; | |
String n = a + ": " + c + " and " + d + " = " + m; | |
return n; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment