Repository navigation
Expand file tree
/
Copy pathTaskThirteen.java
More file actions
61 lines (40 loc) · 2.01 KB
/
Copy pathTaskThirteen.java
File metadata and controls
61 lines (40 loc) · 2.01 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
57
58
59
60
61
import java.util.Scanner;
public class TaskThirteen{
public static void main(String[] agrs){
Scanner userInput = new Scanner(System.in);
<<<<<<< HEAD
System.out.print("Enter an intiger: ");
int integerInput1 = userInput.nextInt();
System.out.print("Enter another integer: ");
int integerInput2 = userInput.nextInt();
int result1 = integerInput1 / integerInput2;
if (integerInput1 == 0){
System.out.println("Error!!! Enter a number above than zero");
}
else
System.out.println(result1);
}
=======
System.out.print("Enter first month saving: ");
int firstMonth = userInput.nextInt();
System.out.print("Enter second month saving: ");
int secondMonth = userInput.nextInt();
System.out.print("Enter third month saving: ");
int thirdMonth = userInput.nextInt();
System.out.print("Enter fourth month saving: ");
int fourthMonth = userInput.nextInt();
System.out.print("Enter fifth month saving: ");
int fifthMonth = userInput.nextInt();
System.out.print("Enter sixth month saving: ");
int sixthMonth = userInput.nextInt();
double savingInterest1 = firstMonth + 0.003125;
double savingInterest2 = secondMonth + savingInterest1 + 0.003125;
double savingInterest3 = thirdMonth + savingInterest2 + 0.003125;
double savingInterest4 = fourthMonth + savingInterest3 + 0.003125;
double savingInterest5 = fifthMonth + savingInterest4 + 0.003125;
double savingInterest6 = sixthMonth + savingInterest5 + 0.003125;
double sum = savingInterest1 + savingInterest2 + savingInterest3 + savingInterest4 + savingInterest5 + savingInterest6;
System.out.print("Sum after first six months:" + sum + "\n");
}
>>>>>>> 23f4b40 (Initial commit)
}