-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay4.java
More file actions
56 lines (48 loc) · 1.52 KB
/
Day4.java
File metadata and controls
56 lines (48 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// ---------------------------------------------------
// Author : Benjamin Kataliko Viranga
// Community : Stunt Business
// Community website : www.stuntbusiness.com
//
// 30 Days - Q&A Java basic
// Day 4 : Challenge II - Input and user functions using the Scanner util from java
// Day 4 | IG : https://www.instagram.com/benjivrik/
// ----------------------------------------------------
// what would be the output of this program ?
import java.util.Scanner;
public class Day4
{
/**
*
* Request the user to enter a number.
* Use the integer entered by the user in the function that you are creating.
* This function return the double of the parameter.
*
*
*/
/**
* This function returns the double of your parameter
* @param value
* @return
*/
public static int double_parameter(int value)
{
return value * 2;
}
/**
* run your class here
* @param args
*/
public static void main(String[] args)
{
// initialize your scanner
Scanner sc = new Scanner(System.in);
// Request the user to enter a value;
System.out.printf("Please enter an integer : ");
int user_value = sc.nextInt();
sc.close();
// display the value entered by the user
System.out.printf("\nYou entered : %d.\n", user_value);
// return the double of the parameter
System.out.println("The double of the parameter is : " + Day4.double_parameter(user_value));
}
}