Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class testSecond {
- public static void main(String[] args) throws IOException {
- BufferedReader reader =
- new BufferedReader(new InputStreamReader(System.in));
- double total = 0;
- double budget = Float.parseFloat(reader.readLine());
- double skiPrice = Float.parseFloat(reader.readLine());
- double shtekiPrice = Float.parseFloat(reader.readLine());
- double skiBoots = skiPrice * 0.4;
- double skiWear = skiPrice * 1.4;
- total = skiPrice + skiBoots + skiWear;
- if (total < 800) {
- total += shtekiPrice;
- }
- if (total <= budget) {
- double left = budget - total;
- System.out.printf("Angel's sum is %.2f lv. He has %.2f lv. left.", total, left);
- } else {
- double needed = total - budget;
- System.out.printf("Not enough money! You need %.2f leva more!", needed);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement