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