-
-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey we can also do this question Like this: #18
Comments
I think it's easy to understand and feasible to write |
Thanku Sir, it was helpful for me and easy to understand. |
@sksharma4u Please feel free to raise a PR for this. Checkout the contributing guidelines |
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
Phone[] obj = new Phone[4];
for(int i=0 ;i<4 ; i++){
obj[i] = new Phone(sc.nextInt() , sc.next() , sc.next(), sc.nextInt());
}
String brand = sc.next();
String os = sc.next();
}
public static int findPriceForGivenBrand(Phone[] phone, String brand)
{
int sum =0 ;
}
public static Phone[] getPhoneIdBasedOnOs(Phone[] phone, String os)
{
int length =0;
int j =0;
Phone[] obj2 = new Phone[length];
for(int i=0 ; i<phone.length ; i++){
if(phone[i].getos().equalsIgnoreCase(os) && phone[i].getprice()>=50000){
obj2 = new Phone[length+1];
obj2[j] = phone[i];
j++;
}
}
return obj2;
}
}
class Phone
{
int id;
String os ;
String brand;
int price;
public int getid(){
return id;
}
public String getos(){
return os;
}
public String getbrand(){
return brand;
}
public int getprice(){
return price;
}
Phone(int id , String os , String brand , int price){
this.id = id;
this.os = os;
this.brand = brand;
this.price = price;
}
}
The text was updated successfully, but these errors were encountered: