Menu
Question Index
...

Write a program to convert from delimited format to mobile object.

Input (Delimited Format String) Output (Mobile Object)
1,Nokia,3412,2.5 NumberOfSims = 1, Maker = "Nokia", Model = "3412", CameraMegaPixels = 2.5
2,Samsung,2252,1.2 NumberOfSims = 2, Maker = "Samsung", Model = "2252", CameraMegaPixels = 1.2
2,Apple,C3752,12.0 NumberOfSims = 2, Maker = "Apple", Model = "C3752", CameraMegaPixels = 12.0
1,Sony,Sony Xperia SL,4.3 NumberOfSims = 1, Maker = "Sony", Model = "Sony Xperia SL", CameraMegaPixels = 4.3



class ConvertDelimitedFormatToMobile
{
    public static void main(String s[])
    {
        String result = "1,Nokia,3412,1.0";
        Mobile mobile = convertToMobile(result);
        System.out.println("Number of sims : " + mobile.numberOfSims);
        System.out.println("Maker :" + mobile.maker);
        System.out.println("Model : " + mobile.model);
        System.out.println("Camera Mega Pixels :" + mobile.cameraMegaPixels);

    }


    public static Mobile convertToMobile(String str) {
    }

}
class Mobile {

int numberOfSims;
String maker;
String model;
double cameraMegaPixels;
}

Doubts

Problems

Topic: Java Number Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App