Skip to content

Instantly share code, notes, and snippets.

@kryvoboker
Created May 13, 2020 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kryvoboker/672515ff53cf6772bd10b73ea6309b1b to your computer and use it in GitHub Desktop.
Save kryvoboker/672515ff53cf6772bd10b73ea6309b1b to your computer and use it in GitHub Desktop.
HomeWork6
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