IBM HACKERRANK CODING SOLUTIONS
Відкрити в Telegram
We provide help for all Exams... Anyone can contact me @AK_Coder for Exam clearance and interviews Trusted ✅
Показати більшеКраїна не вказанаКатегорія не вказана
4 420
Підписники
Немає даних24 години
Немає даних7 днів
Немає даних30 днів
Архів дописів
class Music{
private int playlistNo;
private String type;
private int count;
private double duration;
public Music(int playlistNo, String type,int count,double duration){
this.playlistNo=playlistNo;
this.count=count;
this.type=type;
this.duration=duration;
}
public void setCount(int count){
this.count=count;
}
public void setType(String type){
this.type=type;
}
public void setDuration(double duration){
this.duration=duration;
}
public void setplaylistNo(int playlistNo){
this.playlistNo=playlistNo;
}
public int getPlaylistNo(){
return this.playlistNo;
}
public int getCount(){
return this.count;
}
public double getDuration(){
return this.duration;
}
public String getType(){
return this.type;
}
}
public class Solution{
public static void main(String[] args){
Scanner input=new Scanner(System.in);
Music[] music =new Music[4];
for(int i=0;i<4;i++){
int a=input.nextInt();
input.nextLine();
String b=input.nextLine();
int c=input.nextInt();
double d=input.nextDouble();
Music music2=new Music(a,b,c,d);
music[i]=music2;
}
int f=input.nextInt();
int g=(int)input.nextDouble();
int aver= findAvgOfCount( music, f);
if(aver==0){
System.out.println(average);
}
else{
System.out.println("No playlist found");
}
ArrayList<String> list=new ArrayList<String>();
list=sortTypeByDuration(Music music , int g);
if(list.size()==0){
System.out.println("No playlist found with the given attribute");
}
else{
for(int i=0;i<list.size();i++){
System.out.println(list.get(i));
}
}
}
public static int findAvgOfCount(Music music,int f){
int j=0;
int average=0;
for(int i=0;i<4;i++){
int v=music[i].count;
if(v>f){
sum=sum+v;
j=j+1;
}
}
average=sum/j;
return average;
}
public static void sortTypeByDuration(Music music , int g){
List<String> list=new ArrayList<String>();
for(int i=0;i<4;i++){
int dur=music[i].duration;
if(dur>g){
list.add(music[i].type);
}
}
Collections.sort(music);
return list;
}
}
Sumit, use /status for group filters. Help can be found on our website protectronbot.com. Join our anti-spam chat for updates. You can change the language with the command /lang
Hi dear Prashant Patil 👋🏻
Welome to INFOSYS Feb 20th 🌷
We wish you a good time here ❤️
Hi dear Ashok 👋🏻
Welome to TCS FREE HELP 19th Feb 🌷
We wish you a good time here ❤️
1) 800
2) 585
3)68
4)13
5)375
6)11820
7)
8)
9)
10)
11)
12)
13)
14)
15)
https://t.me/tcsira3rdjan
🚨Again apply today... Register with new mail id and with new phone no. And then apply okay
If you apply today u may get next exam March 5th or 6th
🚨 Apply today guys
