Answer to Question #21862 in C# for Nandakumar

Question #21862
A phone is considered a good phone if all of the following conditions are satisfied:-

1.The manufacturer must be one of Nokia, Samsung, Motorola, Sony or HTC.
2.The model name of the phone must be a single word. For example, "Razr", "Omnia" or "N8" will count, but "C6 01", "EVO 3D" or "Xperia Arc S" won't.
3.It must have either 'Android' or 'Windows' as its operating system.
4.If the CPU is of type "ARMv11" then the cpu speed must be atleast 1024 MHz.
5.If the CPU speed is less then 1024 MHz, then it must have a GPU and "Android" os only.
6.There should be atleast 30 carriers selling this phone and "Vodafone" must be one of them.
Write a method:

boolean isGoodPhone(String model, String manufacturer, String os, int CPUSpeed, String CPUType, boolean hasGPU, String[] carriers)
Expert's answer
bool isGoodPhone(string model, string manufacturer, string os,
int CPUSpeed, string CPUType, bool hasGPU, string[] carriers)
& {
switch (manufacturer)
case "Nokia":
case "Samsung":
case "Motorola":
case "Sony":
case "HTC":
& break;
& return false;
if (model.Trim().Contains(" "))
return false;

if (os != "Android" && os != "Windows")
return false;
if (CPUType == "ARMv11" && CPUSpeed < 1024)
return false;
if (CPUSpeed < 1024)
if (!(hasGPU && os == "Android"))
& return false;
if (carriers.Length < 30 && !carriers.Contains("Vodafone"))
return false;

return true;
& }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be the first!

Leave a comment

Ask Your question

New on Blog