Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package SamiqtIzpit2;
- import java.util.Scanner;
- public class Spaceship {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double width = Double.parseDouble(scanner.nextLine());
- double length = Double.parseDouble(scanner.nextLine());
- double height = Double.parseDouble(scanner.nextLine());
- double middleHeight = Double.parseDouble(scanner.nextLine());
- double x = Math.floor(width * length * height / ((middleHeight + 0.4) * 4));
- if (x >= 3 && x <= 10)
- {
- System.out.printf("The spacecraft holds %.0f astronauts.", x);
- }
- if (x < 3)
- {
- System.out.println("The spacecraft is too small.");
- }
- if (x > 10)
- {
- System.out.println("The spacecraft is too big.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement