0
    int x,y;

    Scanner keyboard = new Scanner (System.in);
    System.out.print("Enter Integer x: ");
    x=keyboard.nextInt();
    System.out.print("Enter Integer y: ");
    y=keyboard.nextInt();
    keyboard.close();

    double g;
    g = 4*x*x+12*x+9;
    System.out.println("g("+x+")= "+g);

    double f;
    f = 3*(x+y/4);
    System.out.println("f("+x+","+y+")= "+f);

    double h;
    h = 3*(4*x*x+12*x+9+y/4);
    System.out.println("f(g("+x+"),"+y+")= "+h);
}

In running part i want given answer in double formation but letting the values in intiger formation

Enter Intiger x: 10

Enter Intiger y: 5

g(10)= 529.0

f(x,y)= 33.75

f(g(x),y)= 1590.75

  • Consider using the stack overflow search engine to see if your question has already been answered. The stack overflow search engine has this URL: www.google.com – DwB Feb 22 '16 at 19:36
  • guys after 20-25 tries i found it int x,y; double b; y=keyboard.nextInt(); b=(int)y; and change the y's in equations – Noobs' Tracker Feb 22 '16 at 19:55
  • No, you haven't figured it out. You need to understand what is heppaning when you write y/4 where y is declared an int. – FredK Feb 22 '16 at 20:10

0 Answers0