-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterest.java
41 lines (38 loc) · 1.16 KB
/
interest.java
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
package com.company;
import java.util.Scanner;
class interest{
public String str;
public int age;
void takeUser(){
System.out.println("Enter the gender ");
Scanner sc=new Scanner(System.in);
str= sc.nextLine();
System.out.println("Enter age ");
age=sc.nextInt();
}
public void returnInterest(){
if (str.equals("male") && age>1 && age<58){
System.out.println("the percentage of interest is 8.4%.");
}
else if (str.equals("male") && age>58 && age<101) {
System.out.println("the percentage of interest is 10.5%.");
}
else if (str.equals("female") && age>58 && age<101 )
{
System.out.println("the percentage of interest is 9.2%.");
}
else if (str.equals("male") && age>1 && age<59) {
System.out.println("the percentage of interest is 8.2%.");
}
else {
System.out.println("you enter something wrong");
}
}
}
public class intrest {
public static void main(String[] args) {
interest it=new interest();
it .takeUser();
it.returnInterest();
}
}