فارسی
باز کردن در Telegram

پستimport java.util.*;

6 مارس 2025
D
Deloitte | COGNIZANT | IBM | CAPGEMINI
import java.util.*; class Laptop{ private int modelNumber; private String brand; private String processorType; private int ramCapacity; private int price; public Laptop(int modelNumber,String brand,String processorType,int ramCapacity,int price){ this.modelNumber=modelNumber; this.brand=brand; this.processorType=processorType; this.ramCapacity=ramCapacity; this.price=price; } public int getModelNumber(){ return modelNumber; } public void setModelNumber(int modelNumber){ this.modelNumber = modelNumber; } public String getBrand(){ return brand; } public void setBrand(String brand){ this.brand = brand; } public String getProcessorType(){ return processorType; } public void setProcessorType(String processorType){ this.processorType = processorType; } public int getRamCapacity(){ return ramCapacity; } public void setRamCapacity(int ramCapacity){ this.ramCapacity = ramCapacity; } public int getPrice(){ return price; } public void setPrice(int price){ this.price = price; } @Override public String toString(){ return "Model-"+modelNumber+"\nBrand-"+brand+"\nPrice-"+price; } } public class Solution{ public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int n=scanner.nextInt(); Laptop[] laptop=new Laptop[n]; for(int i=0;i<n;i++) { int a=scanner.nextInt(); scanner.nextLine(); String b=scanner.nextLine(); String c=scanner.nextLine(); int d=scanner.nextInt(); int e=scanner.nextInt(); laptop[i]=new Laptop(a,b,c,d,e ); } scanner.nextLine(); String par1= scanner.nextLine(); int par2=scanner.nextInt(); scanner.nextLine(); String par3=scanner.nextLine(); scanner.close(); if(getCountOfLaptopByProcessorTypeAndRamCapacity(laptop,par1,par2)==0) { System.out.println("No Laptop found with mentioned attribute"); } else { System.out.println(getCountOfLaptopByProcessorTypeAndRamCapacity(laptop,par1,par2)); } if(findLaptopWithSecondHighestPriceByBrand(laptop,par3)==null) { System.out.println("No Laptop found with mentioned attribute"); } else { System.out.println(findLaptopWithSecondHighestPriceByBrand(laptop,par3)); } } public static Laptop findLaptopWithSecondHighestPriceByBrand(Laptop[] arr,String brand){ Laptop[] result=Arrays.asList(arr).stream().filter(e->e.getBrand().equalsIgnoreCase(brand)).sorted((s1,s2)->{ return s2.getPrice()-s1.getPrice(); }).toArray(size->new Laptop[size]); if(result.length<2) return null; return result[1]; } public static int getCountOfLaptopByProcessorTypeAndRamCapacity(Laptop[] arr,String type,int cap){ int tem=0; for(Laptop var:arr) { if( var.getRamCapacity()==cap && var.getProcessorType().equalsIgnoreCase(type)) tem++; } return tem; } } Amdocs internal Exam✅✅✅
1.1K ·

در همان حوالی فید

DDeloitte | COGNIZANT | IBM | CAPGEMINICTS APTITITUDE✅✅✅ Contact:@MLCODER2DDeloitte | COGNIZANT | IBM | CAPGEMINICTS APTITUDE✅✅✅ Contact:@MLCODER2
این پیام
DDeloitte | COGNIZANT | IBM | CAPGEMINICTS Aptitude ✅✅✅ Contact:@MLCODER2DDeloitte | COGNIZANT | IBM | CAPGEMINICTS APTITUDE✅✅
DDeloitte | COGNIZANT | IBM | CAPGEMINIDeloitte | COGNIZANT | IBM | CAPGEMINI@python_java_Coding · کانال · فناوری
7 178مشترک406میانگین دسترسی پست
فید انجمن باز کردن در Telegram

فید عمومی باز از ایندکس جست‌وجو ChatCrawler — «Google برای Telegram عمومی»؛ با خزش انجمن به‌روز می‌شود. زمان‌ها به UTC است.

فقط محتوای عمومی، API رسمی Telegram. دربارهٔ ما · پرسش‌ها · محدودیت‌های ایندکس · حذف یک صفحه · کاتالوگ · جست‌وجو · روش محاسبهٔ ما