Advertisement
Guest User

Untitled

a guest
Oct 10th, 2015
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.56 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. //package zadacamaraton;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author Besnik
  13.  */
  14.  
  15. /*class IMaraton{
  16.     Atleticar najdobroVreme(){
  17.        
  18.     }
  19.    
  20.     int atleticariOd(String s){
  21.        
  22.     }
  23. }*/
  24. class Atleticar{
  25.     public String ime;
  26.     public String pol;
  27.     public int vozdrast;
  28.     public double vreme;
  29.     public String zemja;
  30.  
  31.     public Atleticar(String ime, String pol, int vozdrast, double vreme, String zemja) {
  32.         this.ime = ime;
  33.         this.pol = pol;
  34.         this.vozdrast = vozdrast;
  35.         this.vreme = vreme;
  36.         this.zemja = zemja;
  37.     }
  38.    
  39.     public void setIme(String ime) {
  40.         this.ime = ime;
  41.     }
  42.  
  43.     public void setPol(String pol) {
  44.         this.pol = pol;
  45.     }
  46.  
  47.     public void setVozdrast(int vozdrast) {
  48.         this.vozdrast = vozdrast;
  49.     }
  50.  
  51.     public void setVreme(double vreme) {
  52.         this.vreme = vreme;
  53.     }
  54.  
  55.     public void setZemja(String zemja) {
  56.         this.zemja = zemja;
  57.     }
  58.  
  59.     public String getIme() {
  60.         return ime;
  61.     }
  62.  
  63.     public String getPol() {
  64.         return pol;
  65.     }
  66.  
  67.     public int getVozdrast() {
  68.         return vozdrast;
  69.     }
  70.  
  71.     public double getVreme() {
  72.         return vreme;
  73.     }
  74.  
  75.     public String getZemja() {
  76.         return zemja;
  77.     }
  78.    
  79. }
  80.  
  81. class Maraton{
  82.     public String mesto;
  83.     public int Godina;
  84.     Atleticar[] atleticari;
  85.  
  86.     public Maraton(String mesto, int Godina, Atleticar[] atleticari) {
  87.         this.mesto = mesto;
  88.         this.Godina = Godina;
  89.         this.atleticari = atleticari;
  90.     }
  91.  
  92.     public String getMesto() {
  93.         return mesto;
  94.     }
  95.  
  96.     public int getGodina() {
  97.         return Godina;
  98.     }
  99.  
  100.     public Atleticar[] getAtleticari() {
  101.         return atleticari;
  102.     }
  103.  
  104.     public void setMesto(String mesto) {
  105.         this.mesto = mesto;
  106.     }
  107.  
  108.     public void setGodina(int Godina) {
  109.         this.Godina = Godina;
  110.     }
  111.  
  112.     public void setAtleticari(Atleticar[] atleticari) {
  113.         this.atleticari = atleticari;
  114.     }
  115.  
  116.  
  117.     int najdobroVreme(){
  118.         return 1;
  119.     }
  120.    
  121.     int atleticariOd(String s){
  122.         return 1;
  123.     }
  124.    
  125. }
  126.  
  127. public class ZadacaMaraton {
  128.     public static void main(String[] args) {
  129.         Scanner input=new Scanner(System.in);
  130.         int n=input.nextInt();
  131.         Atleticar[] atleticari = new Atleticar[n];
  132.        
  133.         String ime;
  134.         String pol;
  135.         int vozrast;
  136.         double vreme;
  137.         String zemja;
  138.        
  139.         input.nextLine();
  140.            
  141.         for(int i=0;i<n;i++)
  142.         {
  143.             ime = input.nextLine();
  144.             pol = input.nextLine();
  145.             vozrast = input.nextInt();
  146.             vreme = input.nextDouble();
  147.             input.nextLine();
  148.             zemja = input.nextLine();
  149.             atleticari[i]=new Atleticar(ime,pol,vozrast,vreme,zemja);
  150.         }
  151.        
  152.         String mesto;
  153.         int godina;
  154.         String zemjaP;
  155.         mesto = input.nextLine();
  156.         godina = input.nextInt();
  157.         input.nextLine();
  158.        
  159.         Maraton m1 = new Maraton(mesto, godina, atleticari);
  160.         System.out.print(m1.toString());
  161.        
  162.         zemjaP = input.nextLine();
  163.         System.out.println("Prvo mesto: " + m1.najdobroVreme().toString());
  164.         System.out.println("Ima vkupno " + m1.atleticariOd(zemjaP) + " atleticar/i od " + zemjaP);
  165.     }
  166.  
  167. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement