-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethods.java
More file actions
32 lines (28 loc) · 908 Bytes
/
Methods.java
File metadata and controls
32 lines (28 loc) · 908 Bytes
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
package src;
import java.util.Scanner;
public class Methods {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
// System.out.print("Enter name to wish: ");
// String name = scanner.next();
//
// System.out.print("Enter number of times: ");
// int times = scanner.nextInt();
//
// happyBirthday(name, times);
System.out.print("Enter Digit to Get: ");
int number = scanner.nextInt();
System.out.printf("Square is %.2f and cube is %.2f", square(number), cube(number));
}
static void happyBirthday(String name, int times){
for(int i = 1; i <= times; i++) {
System.out.printf("Happy Birthday To %s", name);
}
}
static double square(int digit){
return digit * digit;
}
static double cube(int digit){
return digit * digit * digit;
}
}