Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TestApril14_15;
- 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 heigth = Double.parseDouble(scanner.nextLine());
- double astHeigth = Double.parseDouble(scanner.nextLine());
- double volume = width * length * heigth;
- double volumeRoom = (astHeigth + 0.40) * 2 * 2;
- double countAstr = Math.floor(volume / volumeRoom);
- if (countAstr >= 3 && countAstr <= 10) {
- System.out.printf("The spacecraft holds %d astronauts.", (int) countAstr);
- } else if (countAstr < 3){
- System.out.println("The spacecraft is too small.");
- }else if(countAstr>10){
- System.out.println("The spacecraft is too big.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement