Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double width = Double.parseDouble(scanner.nextLine()),
- length = Double.parseDouble(scanner.nextLine()),
- height = Double.parseDouble(scanner.nextLine()),
- averageHeight = Double.parseDouble(scanner.nextLine()),
- spaceshipVolume = width * length * height,
- astronautVolume = (averageHeight + 0.4) * 2 * 2;
- int team = (int) (spaceshipVolume / astronautVolume);
- if (team < 3) {
- System.out.println("The spacecraft is too small.");
- } else if (team > 10) {
- System.out.println("The spacecraft is too big.");
- } else {
- System.out.println("The spacecraft holds " + team + " astronauts.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement