Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Spaceship {
- public static void main(String[] agrs) {
- 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 average = Double.parseDouble(scanner.nextLine());
- double volumeRacket = width * length * height;
- double volumeRoom = 2 * 2 * (average + 0.40);
- int people = (int) (Math.floor(volumeRacket / volumeRoom));
- if (people >= 3 && people <= 10) {
- System.out.printf("The spacecraft holds %d astronauts.", people);
- } else if (people < 3) {
- System.out.println("The spacecraft is too small.");
- } else if (people > 10) {
- System.out.println("The spacecraft is too big.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement