Skip to content

Commit 9ba9f9f

Browse files
Simple-Calculation -Exam problems
1 parent 6529f10 commit 9ba9f9f

File tree

6 files changed

+105
-4
lines changed

6 files changed

+105
-4
lines changed

02.Simple-Calculation/src/Rectangle_Area_2D.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ public static void main(String[] args) {
88

99
double x2 = Double.parseDouble(input.nextLine());
1010
double y2 = Double.parseDouble(input.nextLine());
11-
double area = Math.abs((x1 - x2) * (y1 - y2));
12-
double perimeter = (Math.abs((x1 - x2)) + Math.abs((y1 - y2))) * 2;
13-
System.out.printf("%.0f%n", area);
14-
System.out.printf("%.0f%n", perimeter);
11+
12+
double length = Math.abs(x1 - x2);
13+
double height = Math.abs(y1 - y2);
14+
15+
double area = length * height;
16+
double perimeter = 2 * length + 2* height;
17+
18+
System.out.println(area);
19+
System.out.println(perimeter);
1520
}
1621
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.Scanner;
2+
3+
public class Change_Tiles {
4+
public static void main(String[] args) {
5+
Scanner input = new Scanner(System.in);
6+
int n = Integer.parseInt(input.nextLine());
7+
8+
double tilesWidth = Double.parseDouble(input.nextLine());
9+
double tilesLength = Double.parseDouble(input.nextLine());
10+
int benchWidth = Integer.parseInt(input.nextLine());
11+
int benchLength = Integer.parseInt(input.nextLine());
12+
13+
double areaLanding = Math.pow(n,2);
14+
double areaBench = benchWidth * benchLength;
15+
16+
double neededArea = areaLanding - areaBench;
17+
double areaTiles = tilesWidth* tilesLength;
18+
19+
double totalTiles = neededArea / areaTiles;
20+
double timeNeeded = totalTiles * 0.2;
21+
System.out.printf("%.2f%n", totalTiles);
22+
System.out.printf("%.2f", timeNeeded);
23+
}
24+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java.util.Scanner;
2+
3+
public class Daily_Earnings {
4+
public static void main(String[] args) {
5+
Scanner input = new Scanner(System.in);
6+
int workingDays = Integer.parseInt(input.nextLine());
7+
double earnMoneyPerDay = Double.parseDouble(input.nextLine());
8+
double monetaryRate = Double.parseDouble(input.nextLine());
9+
10+
11+
double oneMonthSalary = workingDays * earnMoneyPerDay;
12+
double incomePerYear = (oneMonthSalary * 12) + (oneMonthSalary * 2.5);
13+
double taxRate = (25 * incomePerYear) / 100;
14+
15+
double totalIncomePerYear = (incomePerYear - taxRate) * monetaryRate;
16+
double result = totalIncomePerYear / 365;
17+
System.out.printf("%.2f", result);
18+
}
19+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import java.util.Scanner;
2+
3+
public class Money {
4+
public static void main(String[] args) {
5+
Scanner input = new Scanner(System.in);
6+
int bitCoinCount = Integer.parseInt(input.nextLine());
7+
double chineseYuan = Double.parseDouble(input.nextLine());
8+
double commission = Double.parseDouble(input.nextLine());
9+
10+
// 1 биткойн = 1168 лева.
11+
// 1 китайски юан = 0.15 долара.
12+
// 1 долар = 1.76 лева.
13+
// 1 евро = 1.95 лева.
14+
15+
double bitCoinInLevs = (double)bitCoinCount * 1168;
16+
double chineseYuanInLevs = chineseYuan * 0.15 * 1.76;
17+
18+
double totalEuros = (bitCoinInLevs + chineseYuanInLevs) / 1.95;
19+
double totalCommission = (commission * totalEuros) / 100;
20+
double result = totalEuros - totalCommission;
21+
System.out.printf("%.2f", result);
22+
}
23+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import java.util.Scanner;
2+
3+
public class Training_Lab {
4+
public static void main(String[] args) {
5+
Scanner input = new Scanner(System.in);
6+
double width = Double.parseDouble(input.nextLine()) * 100;
7+
double height = Double.parseDouble(input.nextLine()) * 100;
8+
9+
double rows = (Math.floor(width / 120));
10+
height = Math.floor((height - 100) / 70);
11+
double total = rows * height - 3;
12+
System.out.println(total);
13+
}
14+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.Scanner;
2+
3+
public class Vegetable_Market {
4+
public static void main(String[] args) {
5+
Scanner input = new Scanner(System.in);
6+
double euro = 1.94;
7+
double priceForVegetables = Double.parseDouble(input.nextLine());
8+
double priceForFruits = Double.parseDouble(input.nextLine());
9+
int totalKgVegetables = Integer.parseInt(input.nextLine());
10+
int totalKgFruits = Integer.parseInt(input.nextLine());
11+
double totalVegetablesPrice = priceForVegetables * totalKgVegetables;
12+
double totalFruitsPrice = priceForFruits * totalKgFruits;
13+
double total = (totalVegetablesPrice + totalFruitsPrice) / euro;
14+
System.out.printf("%.2f", total);
15+
}
16+
}

0 commit comments

Comments
 (0)