Please Help.This should be simple....

Hi, I am a complete noob to Java, I need someone to come up with a short simple program to do the following:
50 + 70 = 120
120/4 = 30,/2= 15

70/4 = 17.5

80/2 = 40

then 15 + 17.5 + 40 = 72.5

I'm sure some one here can work it out. I don't need the main class or thread just the actual working body/code itself.

Comments

  • // The "Maths" class.
    public class Maths
    {
    public static void main (String [] args)
    {
    new Maths ();
    }


    Maths ()
    {
    int total1 = (50 + 70) / 8;

    int total2 = 70 / 4;

    int total3 = 80 / 2;

    int finalTotal = total1 + total2 + total3;
    System.out.println (finalTotal);
    }
    } // Maths class
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion