Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.71 KB | None | 0 0
  1. package ivan;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class _04_Photo_Gallery {
  6.     public static void main(String[] args) {
  7.         Scanner input = new Scanner(System.in);
  8.  
  9.         int photoUmber = Integer.parseInt(input.nextLine());
  10.         int day = Integer.parseInt(input.nextLine());
  11.         int month =  Integer.parseInt(input.nextLine());
  12.         int year = Integer.parseInt(input.nextLine());
  13.         int hours = Integer.parseInt(input.nextLine());
  14.         int minutes = Integer.parseInt(input.nextLine());
  15.         int bytes = Integer.parseInt(input.nextLine());
  16.         int width = Integer.parseInt(input.nextLine());
  17.         int height = Integer.parseInt(input.nextLine());
  18.  
  19.         String printedbytes="";
  20.  
  21.  
  22.         if (bytes < 1000)
  23.         {
  24.             printedbytes = bytes + "B";
  25.         }
  26.         else if (bytes < 1000000)
  27.         {
  28.             bytes /= 1000;
  29.             printedbytes = bytes + "KB";
  30.         }
  31.         else
  32.         {
  33.             bytes /= 1000000;
  34.             printedbytes= bytes + "MB";
  35.         }
  36.  
  37.         String oriention = "square";
  38.         if (width > height)
  39.         {
  40.             oriention = "landscape";
  41.         }
  42.         else if (width < height)
  43.         {
  44.             oriention = "portrait";
  45.         }
  46.         System.out.printf("Name: DSC_%04d.jpg\n",photoUmber);
  47.         System.out.printf("Date Taken: %02d/%02d/%d %02d:%02d\n",day,month,year,hours,minutes);
  48.         System.out.printf("Size: %s\n",printedbytes);
  49.         System.out.printf("Resolution: %dx%d (%s)",width,height,oriention);
  50.  
  51. //
  52. //        Console.WriteLine("Date Taken: {0:d2}/{1}/{2} {3}:{4}", day, month.PadLeft(2, '0'), year, hours.PadLeft(2, '0'), minutes.PadLeft(2, '0'));
  53. //
  54.  
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement