java minvehicleprice with cond
import java.util.Scanner;
class shoe {
int batchnum;
String type;
int size;
double prize;
public int getbatchnum() {
return batchnum;
}
public String gettype() {
return type;
}
public int getsize() {
return size;
}
public double getprize() {
return prize;
}
public void setbatchnum(int batchnum) {
this.batchnum=batchnum;
}
public void settype(String type) {
this.type=type;
}
public void setsize(int size) {
this.size=size;
}
public void setprize(double prize) {
this.prize=prize;
}
public shoe(int batchnum,String type,int size,double prize) {
this.batchnum=batchnum;
this.type=type;
this.size=size;
this.prize=prize;
}
}
class Solut{
public static shoe GetShoewithMaxPrize (shoe[] shoes) {
double min=Double.MAX_VALUE;
for(int j=0;j<shoes.length;j++) {
if(shoes[j].getprize()<min) {
min=shoes[j].getprize();
}
}
for(int j=0;j<shoes.length;j++) {
if (shoes[j].getprize()==min) {
return shoes[j];
}
}
return null;
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
shoe[] shoes = new shoe[a];
for(int i=0;i<a;i++) {
int batchnum=sc.nextInt();
sc.nextLine();
String type=sc.nextLine();
int size=sc.nextInt();
double prize=sc.nextDouble();
shoes[i]=new shoe(batchnum,type,size,prize);
}
shoe ans= GetShoewithMaxPrize(shoes);
if(ans!=null) {
System.out.println(ans.getprize());
}
}
}