Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Exem31March;
- import java.util.Scanner;
- public class Spaceship {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- double widht = Double.parseDouble(s.nextLine());
- double lenght = Double.parseDouble(s.nextLine());
- double hight = Double.parseDouble(s.nextLine());
- double astro = Double.parseDouble(s.nextLine());
- double volume = widht*lenght*hight;
- double personVol = (astro + 0.40)*2*2;
- double allSpace = Math.floor(volume/personVol);
- if (allSpace >=3 && allSpace <=10){
- System.out.printf("The spacecraft holds %.0f astronauts.", allSpace);
- }else if (allSpace < 3){
- System.out.println("The spacecraft is too small.");
- }else {
- System.out.println("The spacecraft is too big.");
- }
- }
- }
Add Comment
Please, Sign In to add comment