Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Izpit2 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double widht = Double.parseDouble(scanner.nextLine());
- double lenght = Double.parseDouble(scanner.nextLine());
- double height = Double.parseDouble(scanner.nextLine());
- double avergHeigth = Double.parseDouble(scanner.nextLine());
- double totlaVolume = widht*lenght*height;
- double roomVolume = (avergHeigth+0.4)*2 *2;
- double numberAustr = Math.floor(totlaVolume/roomVolume);
- if (numberAustr<3){
- double down = Math.floor(numberAustr);
- System.out.println("The spacecraft is too small.");
- }else if (numberAustr>10){
- double down = Math.floor(numberAustr);
- System.out.println("The spacecraft is too big.");
- } else {
- double down = Math.floor(numberAustr);
- System.out.printf("The spacecraft holds %.0f astronauts.",numberAustr);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement